ray-template/js/useContextmenuCoordinate-CihA0nRM.js

1 line
815 B
JavaScript

import{Lr as e,zr as t}from"./directives-toLJ0LRh.js";import{O as n}from"./runtime-core.esm-bundler-CcpTTixp.js";import{I as r,T as i,w as a}from"./isObject-dxr8ANCS.js";import{t as o}from"./effect-dispose-m5NyPzHm.js";var s=(s,c)=>{let l=i(0),u=i(0),d=i(!1),f=()=>{let e=r(c);return typeof e==`boolean`?{capture:e,passive:!1}:{...e,passive:!1}},p=!1,m=0,h=e=>{p&&e||(e||(m+=1),d.value=e)},g=e=>{e.preventDefault(),h(!1);let t=m;n().then(()=>{if(p||t!==m)return;let{clientX:n,clientY:r}=e;l.value=n,u.value=r,h(!0)})},_=e(s,e=>{h(!1);let t=r(c);typeof t==`object`&&t.clickOutside?.(e)},{ignore:()=>{let e=r(c);return typeof e==`object`?r(e.ignore)??[]:[]}}),v=t(s,`contextmenu`,g,f),y=t(s,`click`,()=>{h(!1)}),b=()=>{p=!0,h(!1),v(),y(),_()};return o(b),{stop:b,x:a(l),y:a(u),show:a(d),updateShow:h}};export{s as t};