|
@ -181,8 +181,8 @@ export class Panzoom extends Base { |
|
|
|
|
|
|
|
|
this.content = { |
|
|
this.content = { |
|
|
// Full content dimensions (naturalWidth/naturalHeight for images)
|
|
|
// Full content dimensions (naturalWidth/naturalHeight for images)
|
|
|
origHeight: 0, |
|
|
|
|
|
origWidth: 0, |
|
|
origWidth: 0, |
|
|
|
|
|
origHeight: 0, |
|
|
|
|
|
|
|
|
// Current dimensions of the content
|
|
|
// Current dimensions of the content
|
|
|
width: 0, |
|
|
width: 0, |
|
@ -636,16 +636,19 @@ export class Panzoom extends Base { |
|
|
const $content = this.$content; |
|
|
const $content = this.$content; |
|
|
const $viewport = this.$viewport; |
|
|
const $viewport = this.$viewport; |
|
|
|
|
|
|
|
|
const contentIsImage = this.$content instanceof HTMLImageElement; |
|
|
const contentIsImage = $content instanceof HTMLImageElement; |
|
|
const contentIsZoomable = this.option("zoom"); |
|
|
const contentIsZoomable = this.option("zoom"); |
|
|
const shouldResizeParent = this.option("resizeParent", contentIsZoomable); |
|
|
const shouldResizeParent = this.option("resizeParent", contentIsZoomable); |
|
|
|
|
|
|
|
|
let origWidth = getFullWidth(this.$content); |
|
|
let width = this.option("width"); |
|
|
let origHeight = getFullHeight(this.$content); |
|
|
let height = this.option("height"); |
|
|
|
|
|
|
|
|
|
|
|
let origWidth = width || getFullWidth($content); |
|
|
|
|
|
let origHeight = height || getFullHeight($content); |
|
|
|
|
|
|
|
|
Object.assign($content.style, { |
|
|
Object.assign($content.style, { |
|
|
width: "", |
|
|
width: width ? `${width}px` : "", |
|
|
height: "", |
|
|
height: height ? `${height}px` : "", |
|
|
maxWidth: "", |
|
|
maxWidth: "", |
|
|
maxHeight: "", |
|
|
maxHeight: "", |
|
|
}); |
|
|
}); |
|
@ -659,8 +662,8 @@ export class Panzoom extends Base { |
|
|
origWidth = round(origWidth * ratio); |
|
|
origWidth = round(origWidth * ratio); |
|
|
origHeight = round(origHeight * ratio); |
|
|
origHeight = round(origHeight * ratio); |
|
|
|
|
|
|
|
|
let width = origWidth; |
|
|
width = origWidth; |
|
|
let height = origHeight; |
|
|
height = origHeight; |
|
|
|
|
|
|
|
|
const contentRect = $content.getBoundingClientRect(); |
|
|
const contentRect = $content.getBoundingClientRect(); |
|
|
const viewportRect = $viewport.getBoundingClientRect(); |
|
|
const viewportRect = $viewport.getBoundingClientRect(); |
|
|