Web:Components:Viewer:Sub-Components:Viewer-Base Fixed image size

This commit is contained in:
Akmal Isomadinov 2023-02-06 12:35:02 +05:00
parent 5794262bc1
commit 7521acb1ad

View File

@ -83,6 +83,8 @@ const ViewerBase = (props) => {
};
}
const containerSize = React.useRef(setContainerWidthHeight());
const imageRef = React.useRef(null);
const [isOpen, setIsOpen] = React.useState(false);
const footerHeight = 0;
function reducer(state, action) {
@ -213,9 +215,18 @@ const ViewerBase = (props) => {
if (images.length > 0) {
activeImage = images[currentActiveIndex];
}
if (imageRef.current) {
//abort previous image request
imageRef.current.src = ""
}
let loadComplete = false;
let img = new Image();
imageRef.current = img
img.src = activeImage.src;
img.onload = () => {
clearTimeout(timerId);
if (!init.current) {
@ -647,8 +658,7 @@ const ViewerBase = (props) => {
className={`${prefixCls}-mask`}
style={{
zIndex: zIndex,
backgroundColor: `${
isMobileOnly
backgroundColor: `${isMobileOnly
? !displayVisible
? "rgba(55,55,55,0.6)"
: "#000"