Files
ADHA_mobile_project/assets/imageUtils-eb448745.js
T
2024-02-28 17:06:42 +05:00

2 lines
1.2 KiB
JavaScript

import{A as I,C}from"./index-b5c8f851.js";import{n as L}from"./BitmapTileContainer-1ba3b7ae.js";const A=t=>{let e=class extends t{attach(){this.view.timeline.record(`${this.layer.title} (BitmapTileLayer) Attach`),this._bitmapView=new L(this._tileInfoView),this.container.addChild(this._bitmapView)}detach(){var i;this.container.removeChild(this._bitmapView),(i=this._bitmapView)==null||i.removeAllChildren(),this._bitmapView=null}};return e=I([C("esri.views.2d.layers.BitmapTileLayerView2D")],e),e};function M(t){return t instanceof HTMLImageElement?t.naturalWidth:t.width}function V(t){return t instanceof HTMLImageElement?t.naturalHeight:t.height}function F(t,e,i,o){if(i.level===o.level)return e;const n=t.tileInfo.size,l=t.getTileResolution(i.level),r=t.getTileResolution(o.level);let a=t.getLODInfoAt(o.level);const m=a.getXForColumn(o.col),d=a.getYForRow(o.row);a=t.getLODInfoAt(i.level);const u=a.getXForColumn(i.col),w=a.getYForRow(i.row),s=M(e)/n[0],h=V(e)/n[1],g=Math.round(s*((m-u)/l)),f=Math.round(h*(-(d-w)/l)),v=Math.round(s*n[0]*(r/l)),p=Math.round(h*n[1]*(r/l)),c=T(n);return c.getContext("2d").drawImage(e,g,f,v,p,0,0,n[0],n[1]),c}function T(t){const e=document.createElement("canvas");return[e.width,e.height]=t,e}export{F as n,T as o,A as r};