import{convertUnitToNumber as e}from"./common.js";let handleMouseMove=(t,o)=>{let l=o?.hoverEffect==="zoom"&&o?.zoomType==="default",r=o?.hoverEffect==="zoom"&&o?.zoomType==="glasses",i=o?.hoverEffect==="other",s=o?.hoverEffect!=="none";if(!s)return;let y=t.currentTarget.querySelector("img"),c=t.currentTarget.querySelector("img.hover-image"),n=t.currentTarget.querySelector(".room-len"),f=y?.getBoundingClientRect(),h=y?.clientWidth||0,a=y?.clientHeight||0,p=e(o?.zoom,0),g=!p||p<100?1:p/100||1,m=(h||1)*(o?.hoverEffect==="other"?1:g),u=(a||1)*(o?.hoverEffect==="other"?1:g),d=t.clientX-f?.x,x=t.clientY-f?.y;i&&displayOtherImage({featureImageHoverDom:c}),l&&t.clientX>=f?.x&&t.clientX<=f.right&&t.clientY>=f?.y&&t.clientY<=f.bottom&&displayZoomImage({featureImageDom:y,featureImageHoverDom:c,zoomSize:m,zoomSizeHeight:u,slideWidth:h,imageOffsetX:d,imageOffsetY:x,isEnableShowOtherImage:i}),r&&displayZoomLen({zoomLens:n,zoomSize:m,zoomValue:g,imagePosition:f,slideWidth:h,slideHeight:a,imageOffsetX:d,imageOffsetY:x})},displayOtherImage=({featureImageHoverDom:e})=>{e&&(e.style.opacity="1",e.style.top="0px",e.style.left="0px",e.style.width="100%",e.style.height="100%")},displayZoomLen=({zoomLens:e,zoomSize:t,zoomValue:o,slideWidth:l,slideHeight:r,imageOffsetX:i,imageOffsetY:s})=>{if(!e)return;e.style.opacity="1";let y=e.offsetWidth/2,c=e.offsetHeight/2,n=r||1;i>l-y/o&&(i=l-y/o),i<y/o&&(i=y/o),s>n-c/o&&(s=n-c/o),s<c/o&&(s=c/o),e.style.top=s-c+"px",e.style.left=i-y+"px",e.style.backgroundSize=t+"px "+n*o+"px",e.style.backgroundPosition=`-${i*o-y}px -${s*o-c}px`},displayZoomImage=({featureImageDom:e,featureImageHoverDom:t,zoomSize:o,zoomSizeHeight:l,slideWidth:r,imageOffsetX:i,imageOffsetY:s,isEnableShowOtherImage:y=!1})=>{if(!t)return;t.style.width=`${o}px`,y||(t.style.height=`${l}px`),t.style.opacity="1";let c=i/e?.offsetWidth,n=s/e?.offsetHeight;t.style.top=(e?.offsetHeight-t.offsetHeight)*n+"px",t.style.left=(r-o)*c+"px"},handleMouseOut=e=>{let t=e.currentTarget.querySelector("img.hover-image"),o=e.currentTarget.querySelector(".room-len");t&&(t.style.opacity="0"),o&&(o.style.opacity="0")};export{handleMouseMove,handleMouseOut};
