@yuebai008/cli
Version:
Command line interface for rapid qg-minigame development
1 lines • 1.66 kB
JavaScript
import{DOMModel}from"./DOMModel.js";export var Layer;!function(t){let n;!function(t){t.NonFastScrollable="NonFastScrollable",t.TouchEventHandler="TouchEventHandler",t.WheelEventHandler="WheelEventHandler",t.RepaintsOnScroll="RepaintsOnScroll",t.MainThreadScrollingReason="MainThreadScrollingReason"}(n=t.ScrollRectType||(t.ScrollRectType={}))}(Layer||(Layer={}));export class StickyPositionConstraint{#t;#n;#e;#o;constructor(t,n){this.#t=n.stickyBoxRect,this.#n=n.containingBlockRect,this.#e=null,t&&n.nearestLayerShiftingStickyBox&&(this.#e=t.layerById(n.nearestLayerShiftingStickyBox)),this.#o=null,t&&n.nearestLayerShiftingContainingBlock&&(this.#o=t.layerById(n.nearestLayerShiftingContainingBlock))}stickyBoxRect(){return this.#t}containingBlockRect(){return this.#n}nearestLayerShiftingStickyBox(){return this.#e}nearestLayerShiftingContainingBlock(){return this.#o}}export class LayerTreeBase{#r;#i;layersById;#a;#l;#s;#c;constructor(t){this.#r=t,this.#i=t?t.model(DOMModel):null,this.layersById=new Map,this.#a=null,this.#l=null,this.#s=new Map}target(){return this.#r}root(){return this.#a}setRoot(t){this.#a=t}contentRoot(){return this.#l}setContentRoot(t){this.#l=t}forEachLayer(t,n){return!(!n&&!(n=this.root()))&&(t(n)||n.children().some(this.forEachLayer.bind(this,t)))}layerById(t){return this.layersById.get(t)||null}async resolveBackendNodeIds(t){if(!t.size||!this.#i)return;const n=await this.#i.pushNodesByBackendIdsToFrontend(t);if(n)for(const t of n.keys())this.#s.set(t,n.get(t)||null)}backendNodeIdToNode(){return this.#s}setViewportSize(t){this.#c=t}viewportSize(){return this.#c}nodeForId(t){return this.#i?this.#i.nodeForId(t):null}}