@tomorrowevening/hermes
Version:
An extendable set of Web Tools controlled via a separate window for non-intereference with content.
2 lines (1 loc) • 1.15 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("three"),e=require("../core/types.cjs");class i extends n.EventDispatcher{style={};left=0;top=0;width=0;height=0;ownerDocument=void 0;constructor(){super(),this.ownerDocument=this}get clientWidth(){return this.width}set clientWidth(t){this.width=t}get clientHeight(){return this.height}set clientHeight(t){this.height=t}setPointerCapture(){}releasePointerCapture(){}getBoundingClientRect(){return{x:this.left,y:this.top,left:this.left,top:this.top,width:this.width,height:this.height,right:this.left+this.width,bottom:this.top+this.height,toJSON:()=>({})}}handleEvent(t){if(t.type==="size"){this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height;return}t.preventDefault=e.noop,t.stopPropagation=e.noop,this.dispatchEvent(t)}focus(){}getRootNode(){return this}}class o{targets={};constructor(){this.handleEvent=this.handleEvent.bind(this)}makeProxy(t){const{id:s}=t,r=new i;this.targets[s]=r}getProxy(t){return this.targets[t]}handleEvent(t){this.targets[t.id]?.handleEvent(t.data)}}exports.ElementProxyReceiver=i;exports.ProxyManager=o;