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