fix: NaN invalid CSS width issue
This commit is contained in:
@@ -574,8 +574,8 @@ class ControlledBase extends Component<
|
|||||||
tmp.innerHTML = imgEl.outerHTML;
|
tmp.innerHTML = imgEl.outerHTML;
|
||||||
|
|
||||||
const svg = tmp.firstChild as SVGSVGElement;
|
const svg = tmp.firstChild as SVGSVGElement;
|
||||||
svg.style.width = `${styleModalImg.width ?? 0}px`;
|
svg.style.width = `${styleModalImg.width || 0}px`;
|
||||||
svg.style.height = `${styleModalImg.height ?? 0}px`;
|
svg.style.height = `${styleModalImg.height || 0}px`;
|
||||||
svg.addEventListener("click", this.handleUnzoom);
|
svg.addEventListener("click", this.handleUnzoom);
|
||||||
|
|
||||||
refModalImg.current?.firstChild?.remove?.();
|
refModalImg.current?.firstChild?.remove?.();
|
||||||
|
|||||||
@@ -75,8 +75,11 @@ export const getScale: GetScale = ({
|
|||||||
offset,
|
offset,
|
||||||
targetHeight,
|
targetHeight,
|
||||||
targetWidth,
|
targetWidth,
|
||||||
}) =>
|
}) => {
|
||||||
!hasScalableSrc && targetHeight && targetWidth
|
if (!containerHeight || !containerWidth) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return !hasScalableSrc && targetHeight && targetWidth
|
||||||
? getScaleToWindowMax({
|
? getScaleToWindowMax({
|
||||||
containerHeight,
|
containerHeight,
|
||||||
containerWidth,
|
containerWidth,
|
||||||
@@ -89,6 +92,7 @@ export const getScale: GetScale = ({
|
|||||||
offset,
|
offset,
|
||||||
width: containerWidth,
|
width: containerWidth,
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const URL_REGEX = /url(?:\(['"]?)(.*?)(?:['"]?\))/;
|
const URL_REGEX = /url(?:\(['"]?)(.*?)(?:['"]?\))/;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user