You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
5.9 KiB
15 lines
5.9 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("exports ../chunks/tslib.es6 ../core/domUtils ../core/events ../core/Logger ../core/maybe ../core/reactiveUtils ../core/scheduling ../core/accessorSupport/decorators/property ../core/has ../core/RandomLCG ../core/accessorSupport/decorators/subclass ./overlay/ViewOverlay".split(" "),function(m,f,k,t,u,n,h,p,g,x,y,v,q){function r(e){e&&(k.empty(e),e.parentNode&&e.parentNode.removeChild(e))}const l=[0,0];m.DOMContainer=e=>{e=class extends e{constructor(...a){super(...a);this._freqInfo={freq:16, |
|
time:750};this._overlayRenderTaskHandle=null;this.height=0;this.position=this.overlay=this.messagesCommon=null;this.resizing=!1;this.surface=this.root=null;this.suspended=!0;this.userContent=this.ui=null;this.width=0;this.widthBreakpoint=null;this.addHandles([h.watch(()=>this.cursor,c=>{const {surface:b}=this;b&&b.setAttribute("data-cursor",c)}),h.watch(()=>this.navigating,c=>{const {surface:b}=this;b&&b.setAttribute("data-navigating",c.toString())})])}initialize(){this.addHandles([h.watch(()=>this.ui, |
|
(a,c)=>this._handleUIChange(a,c),h.initial),this.on("focus",()=>this.notifyChange("focused")),this.on("blur",()=>this.notifyChange("focused"))])}destroy(){this.destroyed||(this.ui=n.destroyMaybe(this.ui),this.container=null)}get container(){return this._get("container")??null}set container(a){var c=this._get("container");const b=k.byId(a);b||"string"!==typeof a||u.getLogger(this).error("#container",`element with id '${a}' not found`);if(c!==b)if(this._stopMeasuring(),c&&(c.classList.remove("esri-view"), |
|
this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay&&(this.overlay.destroy(),this._set("overlay",null)),this.root&&(r(this.root),this._set("root",null)),this.userContent&&(k.reparent(this.userContent,c),r(this.userContent),this._set("userContent",null))),b){b.classList.add("esri-view");a=document.createElement("div");a.className="esri-view-user-storage";k.reparent(b,a);b.appendChild(a);this._set("userContent",a);a=document.createElement("div"); |
|
a.className="esri-view-root";b.insertBefore(a,b.firstChild);this._set("root",a);c=document.createElement("div");c.className="esri-view-surface";c.setAttribute("role","application");c.tabIndex=0;a.appendChild(c);this._set("surface",c);var d=new q;a.appendChild(d.surface);this._set("overlay",d);this.addHandles(h.watch(()=>d.needsRender,w=>{this._overlayRenderTaskHandle=w&&!this._overlayRenderTaskHandle?p.addFrameTask({render:()=>this.overlay?.render()}):n.removeMaybe(this._overlayRenderTaskHandle)})); |
|
this.forceDOMReadyCycle();this._set("container",b);this._startMeasuring()}else this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),this._set("container",null)}get focused(){const a=document.activeElement===this.surface;return document.hasFocus()&&a}get size(){return[this.width,this.height]}blur(){this.surface?.blur()}focus(){this.surface?.focus()}pageToContainer(a,c,b){const d=this.position;a-=d?d[0]:0;c-=d?d[1]:0;b?(b[0]=a,b[1]= |
|
c):b=[a,c];return b}containerToPage(a,c,b){const d=this.position;a+=d?d[0]:0;c+=d?d[1]:0;b?(b[0]=a,b[1]=c):b=[a,c];return b}_handleUIChange(a,c){this.removeHandles("ui");c&&c!==a&&c.destroy();a&&(a.view=this,this.addHandles(h.watch(()=>this.root,b=>{if(b){const d=document.createElement("div");b.appendChild(d);b=d}else b=null;a.container=b},h.initial),"ui"));this._set("ui",a)}_stopMeasuring(){this.removeHandles("measuring");this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const a= |
|
this._freqInfo;a.freq=16;a.time=750;this.addHandles([t.on(window,"resize",()=>{a.freq=16;a.time=750}),p.addFrameTask({prepare:c=>{const b=this._measure(),d=this._freqInfo;d.time+=c.deltaTime;b&&(d.freq=16,this._get("resizing")||this._set("resizing",!0));d.time<d.freq||(d.time=0,this._position()||b?d.freq=16:d.freq=Math.min(750,2*d.freq),!b&&512<=d.freq&&this._get("resizing")&&this._set("resizing",!1))}})],"measuring");this._measure();this._position()}_measure(){var a=this.container;const c=a?a.clientWidth: |
|
0;a=a?a.clientHeight:0;if(0===c||0===a)return this.suspended||this._set("suspended",!0),!1;const b=this.width,d=this.height;if(c===b&&a===d)return this.suspended&&this._set("suspended",!1),!1;this._set("width",c);this._set("height",a);this.suspended&&this._set("suspended",!1);this.emit("resize",{oldWidth:b,oldHeight:d,width:c,height:a});return!0}_position(){var a=this.container;const c=this.position;var b;if(b=a)b=(a.ownerDocument||window.document).defaultView,a=a.getBoundingClientRect(),l[0]=a.left+ |
|
(b?.pageXOffset??0),l[1]=a.top+(b?.pageYOffset??0),b=l;a=b;return a?c&&a[0]===c[0]&&a[1]===c[1]?!1:(this._set("position",[a[0],a[1]]),!0):!1}forceDOMReadyCycle(){}};f.__decorate([g.property()],e.prototype,"container",null);f.__decorate([g.property({readOnly:!0})],e.prototype,"focused",null);f.__decorate([g.property({readOnly:!0})],e.prototype,"height",void 0);f.__decorate([g.property()],e.prototype,"messagesCommon",void 0);f.__decorate([g.property({type:q})],e.prototype,"overlay",void 0);f.__decorate([g.property({readOnly:!0})], |
|
e.prototype,"position",void 0);f.__decorate([g.property({readOnly:!0})],e.prototype,"resizing",void 0);f.__decorate([g.property({readOnly:!0})],e.prototype,"root",void 0);f.__decorate([g.property({value:null,readOnly:!0})],e.prototype,"size",null);f.__decorate([g.property({readOnly:!0})],e.prototype,"surface",void 0);f.__decorate([g.property({readOnly:!0})],e.prototype,"suspended",void 0);f.__decorate([g.property()],e.prototype,"ui",void 0);f.__decorate([g.property({readOnly:!0})],e.prototype,"userContent", |
|
void 0);f.__decorate([g.property({readOnly:!0})],e.prototype,"width",void 0);f.__decorate([g.property()],e.prototype,"widthBreakpoint",void 0);return e=f.__decorate([v.subclass("esri.views.DOMContainer")],e)};Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}); |