@yuebai008/cli
Version:
Command line interface for rapid qg-minigame development
1 lines • 797 B
JavaScript
import rootViewStyles from"./rootView.css.legacy.js";import{VBox}from"./Widget.js";import{ZoomManager}from"./ZoomManager.js";export class RootView extends VBox{window;constructor(){super(),this.markAsRoot(),this.element.classList.add("root-view"),this.registerRequiredCSS(rootViewStyles),this.element.setAttribute("spellcheck","false")}attachToDocument(t){t.defaultView&&t.defaultView.addEventListener("resize",this.doResize.bind(this),!1),this.window=t.defaultView,this.doResize(),this.show(t.body)}doResize(){if(this.window){const t=this.constraints().minimum,e=ZoomManager.instance().zoomFactor(),i=Math.min(0,this.window.innerWidth-t.width/e);this.element.style.marginRight=i+"px";const o=Math.min(0,this.window.innerHeight-t.height/e);this.element.style.marginBottom=o+"px"}super.doResize()}}