@deck.gl/mapbox 8.10.0-alpha.6 → 8.10.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +3 -3
- package/dist.min.js +2 -6
- package/package.json +3 -3
package/dist/dist.dev.js
CHANGED
|
@@ -62,14 +62,14 @@ var __exports__ = (() => {
|
|
|
62
62
|
// src/deck-utils.ts
|
|
63
63
|
var import_core2 = __toESM(require_core());
|
|
64
64
|
|
|
65
|
-
// ../../node_modules/@math.gl/web-mercator/dist/
|
|
65
|
+
// ../../node_modules/@math.gl/web-mercator/dist/assert.js
|
|
66
66
|
function assert(condition, message) {
|
|
67
67
|
if (!condition) {
|
|
68
68
|
throw new Error(message || "@math.gl/web-mercator: assertion failed.");
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
// ../../node_modules/@math.gl/web-mercator/dist/
|
|
72
|
+
// ../../node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js
|
|
73
73
|
var PI = Math.PI;
|
|
74
74
|
var PI_4 = PI / 4;
|
|
75
75
|
var DEGREES_TO_RADIANS = PI / 180;
|
|
@@ -91,7 +91,7 @@ var __exports__ = (() => {
|
|
|
91
91
|
return TILE_SIZE / EARTH_CIRCUMFERENCE / latCosine;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
// ../../node_modules/@math.gl/web-mercator/dist/
|
|
94
|
+
// ../../node_modules/@math.gl/web-mercator/dist/get-bounds.js
|
|
95
95
|
var DEGREES_TO_RADIANS2 = Math.PI / 180;
|
|
96
96
|
|
|
97
97
|
// src/deck-utils.ts
|
package/dist.min.js
CHANGED
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var
|
|
8
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
9
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rt(r,e){if(r){if(typeof r=="string")return xe(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return xe(r,e)}}function xe(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function et(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n=[],a=!0,o=!1,v,i;try{for(t=t.call(r);!(a=(v=t.next()).done)&&(n.push(v.value),!(e&&n.length===e));a=!0);}catch(s){o=!0,i=s}finally{try{!a&&t.return!=null&&t.return()}finally{if(o)throw i}}return n}}function tt(r){if(Array.isArray(r))return r}function Pr(r){var e=r.width,t=r.height,n=r.bounds,a=r.minExtent,o=a===void 0?0:a,v=r.maxZoom,i=v===void 0?24:v,s=r.offset,l=s===void 0?[0,0]:s,c=qr(n,2),f=qr(c[0],2),p=f[0],u=f[1],y=qr(c[1],2),_=y[0],w=y[1],x=nt(r.padding),P=D([p,or(w,-rr,rr)]),h=D([_,or(u,-rr,rr)]),m=[Math.max(Math.abs(h[0]-P[0]),o),Math.max(Math.abs(h[1]-P[1]),o)],M=[e-x.left-x.right-Math.abs(l[0])*2,t-x.top-x.bottom-Math.abs(l[1])*2];k(M[0]>0&&M[1]>0);var d=M[0]/m[0],A=M[1]/m[1],I=(x.right-x.left)/2/d,S=(x.bottom-x.top)/2/A,L=[(h[0]+P[0])/2+I,(h[1]+P[1])/2+S],T=Y(L),E=Math.min(i,xr(Math.abs(Math.min(d,A))));return k(Number.isFinite(E)),{longitude:T[0],latitude:T[1],zoom:E}}function nt(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return typeof r=="number"?{top:r,bottom:r,left:r,right:r}:(k(Number.isFinite(r.top)&&Number.isFinite(r.bottom)&&Number.isFinite(r.left)&&Number.isFinite(r.right)),r)}var Me=Math.PI/180;function br(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=r.width,n=r.height,a=r.unproject,o={targetZ:e},v=a([0,n],o),i=a([t,n],o),s,l,c=r.fovy?.5*r.fovy*Me:Math.atan(.5/r.altitude),f=(90-r.pitch)*Me;return c>f-.01?(s=ge(r,0,e),l=ge(r,t,e)):(s=a([0,0],o),l=a([t,0],o)),[v,i,l,s]}function ge(r,e,t){var n=r.pixelUnprojectionMatrix,a=W(n,[e,0,1,1]),o=W(n,[e,r.height,1,1]),v=t*r.distanceScales.unitsPerMeter[2],i=(v-a[2])/(o[2]-a[2]),s=mr([],a,o,i),l=Y(s);return l.push(t),l}function Or(r){return ot(r)||it(r)||me(r)||at()}function at(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
10
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function it(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function ot(r){if(Array.isArray(r))return Vr(r)}function lr(r,e){return vt(r)||lt(r,e)||me(r,e)||st()}function st(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
11
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function me(r,e){if(r){if(typeof r=="string")return Vr(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Vr(r,e)}}function Vr(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function lt(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n=[],a=!0,o=!1,v,i;try{for(t=t.call(r);!(a=(v=t.next()).done)&&(n.push(v.value),!(e&&n.length===e));a=!0);}catch(s){o=!0,i=s}finally{try{!a&&t.return!=null&&t.return()}finally{if(o)throw i}}return n}}function vt(r){if(Array.isArray(r))return r}function ct(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var ue=function(){function r(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{width:1,height:1};ct(this,r),O(this,"latitude",void 0),O(this,"longitude",void 0),O(this,"zoom",void 0),O(this,"pitch",void 0),O(this,"bearing",void 0),O(this,"altitude",void 0),O(this,"fovy",void 0),O(this,"meterOffset",void 0),O(this,"center",void 0),O(this,"width",void 0),O(this,"height",void 0),O(this,"scale",void 0),O(this,"distanceScales",void 0),O(this,"viewMatrix",void 0),O(this,"projectionMatrix",void 0),O(this,"viewProjectionMatrix",void 0),O(this,"pixelProjectionMatrix",void 0),O(this,"pixelUnprojectionMatrix",void 0),O(this,"equals",function(b){return b instanceof r?b.width===t.width&&b.height===t.height&&Ir(b.projectionMatrix,t.projectionMatrix)&&Ir(b.viewMatrix,t.viewMatrix):!1}),O(this,"project",function(b){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=g.topLeft,Z=j===void 0?!0:j,R=t.projectPosition(b),N=$r(R,t.pixelProjectionMatrix),H=lr(N,2),fr=H[0],nr=H[1],ar=Z?nr:t.height-nr;return b.length===2?[fr,ar]:[fr,ar,N[2]]}),O(this,"unproject",function(b){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=g.topLeft,Z=j===void 0?!0:j,R=g.targetZ,N=R===void 0?void 0:R,H=lr(b,3),fr=H[0],nr=H[1],ar=H[2],Se=Z?nr:t.height-nr,Le=N&&N*t.distanceScales.unitsPerMeter[2],Ie=wr([fr,Se,ar],t.pixelUnprojectionMatrix,Le),je=t.unprojectPosition(Ie),Tr=lr(je,3),Sr=Tr[0],Lr=Tr[1],De=Tr[2];return Number.isFinite(ar)?[Sr,Lr,De]:Number.isFinite(N)?[Sr,Lr,N]:[Sr,Lr]}),O(this,"projectPosition",function(b){var g=D(b),j=lr(g,2),Z=j[0],R=j[1],N=(b[2]||0)*t.distanceScales.unitsPerMeter[2];return[Z,R,N]}),O(this,"unprojectPosition",function(b){var g=Y(b),j=lr(g,2),Z=j[0],R=j[1],N=(b[2]||0)*t.distanceScales.metersPerUnit[2];return[Z,R,N]});var a=n.width,o=n.height,v=n.altitude,i=v===void 0?null:v,s=n.fovy,l=s===void 0?null:s,c=n.latitude,f=c===void 0?0:c,p=n.longitude,u=p===void 0?0:p,y=n.zoom,_=y===void 0?0:y,w=n.pitch,x=w===void 0?0:w,P=n.bearing,h=P===void 0?0:P,m=n.position,M=m===void 0?null:m,d=n.nearZMultiplier,A=d===void 0?.02:d,I=n.farZMultiplier,S=I===void 0?1.01:I;a=a||1,o=o||1,l===null&&i===null?(i=kr,l=J(i)):l===null?l=J(i):i===null&&(i=_r(l));var L=yr(_);i=Math.max(.75,i);var T=Cr({longitude:u,latitude:f}),E=D([u,f]);E.push(0),M&&le(E,E,ce([],M,T.unitsPerMeter)),this.projectionMatrix=Zr({width:a,height:o,scale:L,center:E,pitch:x,fovy:l,nearZMultiplier:A,farZMultiplier:S}),this.viewMatrix=Yr({height:o,scale:L,center:E,pitch:x,bearing:h,altitude:i}),this.width=a,this.height=o,this.scale=L,this.latitude=f,this.longitude=u,this.zoom=_,this.pitch=x,this.bearing=h,this.altitude=i,this.fovy=l,this.center=E,this.meterOffset=M||[0,0,0],this.distanceScales=T,this._initMatrices(),Object.freeze(this)}var e=r.prototype;return e._initMatrices=function(){var n=this.width,a=this.height,o=this.projectionMatrix,v=this.viewMatrix,i=Q();Mr(i,i,o),Mr(i,i,v),this.viewProjectionMatrix=i;var s=Q();gr(s,s,[n/2,-a/2,1]),sr(s,s,[1,-1,0]),Mr(s,s,i);var l=te(Q(),s);if(!l)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=s,this.pixelUnprojectionMatrix=l},e.projectFlat=function(n){return D(n)},e.unprojectFlat=function(n){return Y(n)},e.getMapCenterByLngLatPosition=function(n){var a=n.lngLat,o=n.pos,v=wr(o,this.pixelUnprojectionMatrix),i=D(a),s=jr([],i,se([],v)),l=jr([],this.center,s);return Y(l)},e.fitBounds=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=this.width,v=this.height,i=Pr(Object.assign({width:o,height:v,bounds:n},a)),s=i.longitude,l=i.latitude,c=i.zoom;return new r({width:o,height:v,longitude:s,latitude:l,zoom:c})},e.getBounds=function(n){var a=this.getBoundingRegion(n),o=Math.min.apply(Math,Or(a.map(function(l){return l[0]}))),v=Math.max.apply(Math,Or(a.map(function(l){return l[0]}))),i=Math.min.apply(Math,Or(a.map(function(l){return l[1]}))),s=Math.max.apply(Math,Or(a.map(function(l){return l[1]})));return[[o,i],[v,s]]},e.getBoundingRegion=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return br(this,n.z||0)},e.getLocationAtPoint=function(n){var a=n.lngLat,o=n.pos;return this.getMapCenterByLngLatPosition({lngLat:a,pos:o})},r}();function ye(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function B(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ye(Object(t),!0).forEach(function(n){ht(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ye(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ht(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var Wr=512,pt=Math.PI/180;function Er(r){var e=r.map,t=r.gl,n=r.deck;if(e.__deck)return e.__deck;var a=n?.props._customRender,o=n?.props.onLoad,v=Br(B(B({},n?.props),{},{_customRender:function(){e.triggerRepaint(),a?.("")}})),i;return(!n||n.props.gl===t)&&(Object.assign(v,{gl:t,width:null,height:null,touchAction:"unset",viewState:er(e)}),n!=null&&n.isInitialized?_e(n,e):v.onLoad=function(){o?.(),_e(i,e)}),n?(i=n,n.setProps(v),n.userData.isExternal=!0):(i=new X.Deck(v),e.on("remove",function(){Xr(e)})),i.userData.mapboxLayers=new Set,e.__deck=i,e.on("render",function(){i.isInitialized&&xt(i,e)}),i}function _e(r,e){var t=function n(){r.isInitialized?Mt(r,e):e.off("move",n)};e.on("move",t)}function Xr(r){var e;(e=r.__deck)===null||e===void 0||e.finalize(),r.__deck=null}function Br(r){var e=B(B({},r),{},{parameters:B({depthMask:!0,depthTest:!0,blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthFunc:515,blendEquation:32774},r.parameters),views:r.views||[new X.MapView({id:"mapbox"})]});return e}function we(r,e){r.userData.mapboxLayers.add(e),Ur(r)}function Pe(r,e){r.userData.mapboxLayers.delete(e),Ur(r)}function be(r,e){Ur(r)}function Oe(r,e,t){var n=r.userData,a=n.currentViewport,o=!1;a||(a=Ee(r,e,!0),r.userData.currentViewport=a,o=!0),r.isInitialized&&r._drawLayers("mapbox-repaint",{viewports:[a],layerFilter:function(i){var s=i.layer;return t.id===s.id||s.props.operation.includes("terrain")},clearStack:o,clearCanvas:!1})}function er(r){var e,t=r.getCenter(),n=t.lng,a=t.lat,o={longitude:(n+540)%360-180,latitude:a,zoom:r.getZoom(),bearing:r.getBearing(),pitch:r.getPitch(),padding:r.getPadding(),repeat:r.getRenderWorldCopies()};return(e=r.getTerrain)!==null&&e!==void 0&&e.call(r)&&dt(r,o),o}function dt(r,e){if(r.getFreeCameraOptions){var t=r.getFreeCameraOptions(),n=t.position;if(!n||n.z===void 0)return;var a=r.transform.height,o=e.longitude,v=e.latitude,i=e.pitch,s=n.x*Wr,l=(1-n.y)*Wr,c=n.z*Wr,f=D([o,v]),p=s-f[0],u=l-f[1],y=Math.sqrt(p*p+u*u),_=i*pt,w=1.5*a,x=_<.001?w*Math.cos(_)/c:w*Math.sin(_)/y;e.zoom=Math.log2(x);var P=w*Math.cos(_)/x,h=c-P;e.position=[0,0,h/Fr(v)]}else typeof r.transform.elevation=="number"&&(e.position=[0,0,r.transform.elevation])}function Ee(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return new X.WebMercatorViewport(B(B({id:"mapbox",x:0,y:0,width:r.width,height:r.height},er(e)),{},{nearZMultiplier:t?.02:.1,nearZ:e.transform._nearZ/e.transform.height,farZ:e.transform._farZ/e.transform.height}))}function xt(r,e){var t=r.userData,n=t.mapboxLayers,a=t.isExternal;if(a){var o=Array.from(n,function(f){return f.id}),v=(0,X._flatten)(r.props.layers,Boolean),i=v.some(function(f){return f&&!o.includes(f.id)}),s=r.getViewports(),l=s.findIndex(function(f){return f.id==="mapbox"}),c=s.length>1||l<0;(i||c)&&(l>=0&&(s=s.slice(),s[l]=Ee(r,e,!1)),r._drawLayers("mapbox-repaint",{viewports:s,layerFilter:function(p){return(!r.props.layerFilter||r.props.layerFilter(p))&&(p.viewport.id!=="mapbox"||!o.includes(p.layer.id))},clearCanvas:!1}))}r.userData.currentViewport=null}function Mt(r,e){r.setProps({viewState:er(e)}),r.needsRedraw({clearRedrawFlags:!0})}function Ur(r){if(!r.userData.isExternal){var e=[];r.userData.mapboxLayers.forEach(function(t){var n=t.props.type,a=new n(t.props);e.push(a)}),r.setProps({layers:e})}}function gt(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Ar=function(){function r(t){if(gt(this,r),this.id=void 0,this.type=void 0,this.renderingMode=void 0,this.map=void 0,this.deck=void 0,this.props=void 0,!t.id)throw new Error("Layer must have an unique id");this.id=t.id,this.type="custom",this.renderingMode=t.renderingMode||"3d",this.map=null,this.deck=null,this.props=t}var e=r.prototype;return e.onAdd=function(n,a){this.map=n,this.deck=Er({map:n,gl:a,deck:this.props.deck}),we(this.deck,this)},e.onRemove=function(){this.deck&&Pe(this.deck,this)},e.setProps=function(n){Object.assign(this.props,n,{id:this.id}),this.deck&&be(this.deck,this)},e.render=function(){Oe(this.deck,this.map,this)},r}();var U=ir(G());var Gr=ir(G());function zr(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=mt(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0,a=function(){};return{s:a,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(l){throw l},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
12
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,v=!1,i;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return o=l.done,l},e:function(l){v=!0,i=l},f:function(){try{!o&&t.return!=null&&t.return()}finally{if(v)throw i}}}}function mt(r,e){if(r){if(typeof r=="string")return Ae(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ae(r,e)}}function Ae(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var Hr="__UNDEFINED__";function vr(r,e,t,n){if(!(!r||!e||!r.style||!r.style._loaded)){var a=(0,Gr._flatten)(n,Boolean);if(t!==n){var o=(0,Gr._flatten)(t,Boolean),v=new Set(o.map(function(g){return g.id})),i=zr(a),s;try{for(i.s();!(s=i.n()).done;){var l=s.value;v.delete(l.id)}}catch(g){i.e(g)}finally{i.f()}var c=zr(v),f;try{for(c.s();!(f=c.n()).done;){var p=f.value;r.getLayer(p)&&r.removeLayer(p)}}catch(g){c.e(g)}finally{c.f()}}var u=zr(a),y;try{for(u.s();!(y=u.n()).done;){var _=y.value,w=r.getLayer(_.id);w?w.implementation.setProps(_.props):r.addLayer(new Ar({id:_.id,deck:e}),_.props.beforeId)}}catch(g){u.e(g)}finally{u.f()}var x=r.style._order,P={},h=zr(a),m;try{for(h.s();!(m=h.n()).done;){var M=m.value,d=M.props.beforeId;(!d||!x.includes(d))&&(d=Hr),P[d]=P[d]||[],P[d].push(M.id)}}catch(g){h.e(g)}finally{h.f()}for(var A in P)for(var I=P[A],S=A===Hr?x.length:x.indexOf(A),L=A===Hr?void 0:A,T=I.length-1;T>=0;T--){var E=I[T],b=x.indexOf(E);b!==S-1&&(r.moveLayer(E,L),b>S&&S++),S--,L=E}}}var ut=["interleaved"];function yt(r,e){if(r==null)return{};var t=_t(r,e),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(a=0;a<o.length;a++)n=o[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function _t(r,e){if(r==null)return{};var t={},n=Object.keys(r),a,o;for(o=0;o<n.length;o++)a=n[o],!(e.indexOf(a)>=0)&&(t[a]=r[a]);return t}function ze(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function tr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ze(Object(t),!0).forEach(function(n){wt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ze(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function wt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pt(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Te=function(){function r(t){var n=this;Pt(this,r),this._props=void 0,this._deck=void 0,this._map=void 0,this._container=void 0,this._interleaved=void 0,this._lastMouseDownPoint=void 0,this._handleStyleChange=function(){vr(n._map,n._deck,n._props.layers,n._props.layers)},this._updateContainerSize=function(){if(n._map&&n._container){var i=n._map.getContainer(),s=i.clientWidth,l=i.clientHeight;Object.assign(n._container.style,{width:"".concat(s,"px"),height:"".concat(l,"px")})}},this._updateViewState=function(){var i=n._deck;i&&(i.setProps({viewState:er(n._map)}),i.isInitialized&&i.redraw())},this._handleMouseEvent=function(i){var s=n._deck;if(!(!s||!s.isInitialized)){var l={type:i.type,offsetCenter:i.point,srcEvent:i},c=n._lastMouseDownPoint;switch(!i.point&&c&&(l.deltaX=i.originalEvent.clientX-c.clientX,l.deltaY=i.originalEvent.clientY-c.clientY,l.offsetCenter={x:c.x+l.deltaX,y:c.y+l.deltaY}),l.type){case"mousedown":s._onPointerDown(l),n._lastMouseDownPoint=tr(tr({},i.point),{},{clientX:i.originalEvent.clientX,clientY:i.originalEvent.clientY});break;case"dragstart":l.type="panstart",s._onEvent(l);break;case"drag":l.type="panmove",s._onEvent(l);break;case"dragend":l.type="panend",s._onEvent(l);break;case"click":l.tapCount=1,s._onEvent(l);break;case"dblclick":l.type="click",l.tapCount=2,s._onEvent(l);break;case"mousemove":l.type="pointermove",s._onPointerMove(l);break;case"mouseout":l.type="pointerleave",s._onPointerMove(l);break;default:return}}};var a=t.interleaved,o=a===void 0?!1:a,v=yt(t,ut);this._interleaved=o,this._props=v}var e=r.prototype;return e.setProps=function(n){this._interleaved&&n.layers&&vr(this._map,this._deck,this._props.layers,n.layers),Object.assign(this._props,n),this._deck&&this._deck.setProps(this._interleaved?Br(this._props):this._props)},e.onAdd=function(n){return this._map=n,this._interleaved?this._onAddInterleaved(n):this._onAddOverlaid(n)},e._onAddOverlaid=function(n){var a=document.createElement("div");return Object.assign(a.style,{position:"absolute",left:0,top:0,pointerEvents:"none"}),this._container=a,this._deck=new U.Deck(tr(tr({},this._props),{},{parent:a,viewState:er(n)})),n.on("resize",this._updateContainerSize),n.on("render",this._updateViewState),n.on("mousedown",this._handleMouseEvent),n.on("dragstart",this._handleMouseEvent),n.on("drag",this._handleMouseEvent),n.on("dragend",this._handleMouseEvent),n.on("mousemove",this._handleMouseEvent),n.on("mouseout",this._handleMouseEvent),n.on("click",this._handleMouseEvent),n.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),a},e._onAddInterleaved=function(n){return this._deck=Er({map:n,gl:n.painter.context.gl,deck:new U.Deck(tr(tr({},this._props),{},{gl:n.painter.context.gl}))}),n.on("styledata",this._handleStyleChange),vr(n,this._deck,[],this._props.layers),document.createElement("div")},e.onRemove=function(){var n=this._map;n&&(this._interleaved?this._onRemoveInterleaved(n):this._onRemoveOverlaid(n)),this._deck=void 0,this._map=void 0,this._container=void 0},e._onRemoveOverlaid=function(n){var a;n.off("resize",this._updateContainerSize),n.off("render",this._updateViewState),n.off("mousedown",this._handleMouseEvent),n.off("dragstart",this._handleMouseEvent),n.off("drag",this._handleMouseEvent),n.off("dragend",this._handleMouseEvent),n.off("mousemove",this._handleMouseEvent),n.off("mouseout",this._handleMouseEvent),n.off("click",this._handleMouseEvent),n.off("dblclick",this._handleMouseEvent),(a=this._deck)===null||a===void 0||a.finalize()},e._onRemoveInterleaved=function(n){n.off("styledata",this._handleStyleChange),vr(n,this._deck,this._props.layers,[]),Xr(n)},e.getDefaultPosition=function(){return"top-left"},e.pickObject=function(n){return(0,U.assert)(this._deck),this._deck.pickObject(n)},e.pickMultipleObjects=function(n){return(0,U.assert)(this._deck),this._deck.pickMultipleObjects(n)},e.pickObjects=function(n){return(0,U.assert)(this._deck),this._deck.pickObjects(n)},e.finalize=function(){this._map&&this._map.removeControl(this)},e.getCanvas=function(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null},r}();return $e(cr);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var yt=Object.create;var N=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var wt=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var Ot=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports),Et=(t,n)=>{for(var r in n)N(t,r,{get:n[r],enumerable:!0})},R=(t,n,r,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of xt(n))!Pt.call(t,o)&&o!==r&&N(t,o,{get:()=>n[o],enumerable:!(e=bt(n,o))||e.enumerable});return t},m=(t,n,r)=>(R(t,n,"default"),r&&R(r,n,"default")),k=(t,n,r)=>(r=t!=null?yt(wt(t)):{},R(n||!t||!t.__esModule?N(r,"default",{value:t,enumerable:!0}):r,t)),Lt=t=>R(N({},"__esModule",{value:!0}),t);var L=Ot((oe,st)=>{st.exports=globalThis.deck});var z={};Et(z,{MapboxLayer:()=>U,MapboxOverlay:()=>Mt});var d={},at=k(L());m(d,k(L()));if(!at.Layer)throw new Error("@deck.gl/core is not found");m(z,d);var g=k(L());function Z(t,n){if(!t)throw new Error(n||"@math.gl/web-mercator: assertion failed.")}var b=Math.PI,St=b/4,Y=b/180,fe=180/b,q=512,kt=4003e4;function T(t){let[n,r]=t;Z(Number.isFinite(n)),Z(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let e=n*Y,o=r*Y,c=q*(e+b)/(2*b),l=q*(b+Math.log(Math.tan(St+o*.5)))/(2*b);return[c,l]}function G(t){let n=Math.cos(t*Y);return q/kt/n}var Me=Math.PI/180;function ut(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,e)}return r}function x(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?ut(Object(r),!0).forEach(function(e){Wt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Wt(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var H=512,Yt=Math.PI/180;function V(t){var n=t.map,r=t.gl,e=t.deck;if(n.__deck)return n.__deck;var o=e?.props._customRender,c=e?.props.onLoad,l=K(x(x({},e?.props),{},{_customRender:function(){n.triggerRepaint(),o?.("")}})),i;return(!e||e.props.gl===r)&&(Object.assign(l,{gl:r,width:null,height:null,touchAction:"unset",viewState:j(n)}),e!=null&&e.isInitialized?ft(e,n):l.onLoad=function(){c?.(),ft(i,n)}),e?(i=e,e.setProps(l),e.userData.isExternal=!0):(i=new g.Deck(l),n.on("remove",function(){$(n)})),i.userData.mapboxLayers=new Set,n.__deck=i,n.on("render",function(){i.isInitialized&&Gt(i,n)}),i}function ft(t,n){var r=function e(){t.isInitialized?Ht(t,n):n.off("move",e)};n.on("move",r)}function $(t){var n;(n=t.__deck)===null||n===void 0||n.finalize(),t.__deck=null}function K(t){var n=x(x({},t),{},{parameters:x({depthMask:!0,depthTest:!0,blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthFunc:515,blendEquation:32774},t.parameters),views:t.views||[new g.MapView({id:"mapbox"})]});return n}function dt(t,n){t.userData.mapboxLayers.add(n),J(t)}function ht(t,n){t.userData.mapboxLayers.delete(n),J(t)}function pt(t,n){J(t)}function vt(t,n,r){var e=t.userData,o=e.currentViewport,c=!1;o||(o=mt(t,n,!0),t.userData.currentViewport=o,c=!0),t.isInitialized&&t._drawLayers("mapbox-repaint",{viewports:[o],layerFilter:function(i){var a=i.layer;return r.id===a.id||a.props.operation.includes("terrain")},clearStack:c,clearCanvas:!1})}function j(t){var n,r=t.getCenter(),e=r.lng,o=r.lat,c={longitude:(e+540)%360-180,latitude:o,zoom:t.getZoom(),bearing:t.getBearing(),pitch:t.getPitch(),padding:t.getPadding(),repeat:t.getRenderWorldCopies()};return(n=t.getTerrain)!==null&&n!==void 0&&n.call(t)&&qt(t,c),c}function qt(t,n){if(t.getFreeCameraOptions){var r=t.getFreeCameraOptions(),e=r.position;if(!e||e.z===void 0)return;var o=t.transform.height,c=n.longitude,l=n.latitude,i=n.pitch,a=e.x*H,s=(1-e.y)*H,u=e.z*H,f=T([c,l]),h=a-f[0],_=s-f[1],A=Math.sqrt(h*h+_*_),p=i*Yt,P=1.5*o,M=p<.001?P*Math.cos(p)/u:P*Math.sin(p)/A;n.zoom=Math.log2(M);var y=P*Math.cos(p)/M,O=u-y;n.position=[0,0,O/G(l)]}else typeof t.transform.elevation=="number"&&(n.position=[0,0,t.transform.elevation])}function mt(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return new g.WebMercatorViewport(x(x({id:"mapbox",x:0,y:0,width:t.width,height:t.height},j(n)),{},{nearZMultiplier:r?.02:.1,nearZ:n.transform._nearZ/n.transform.height,farZ:n.transform._farZ/n.transform.height}))}function Gt(t,n){var r=t.userData,e=r.mapboxLayers,o=r.isExternal;if(o){var c=Array.from(e,function(f){return f.id}),l=(0,g._flatten)(t.props.layers,Boolean),i=l.some(function(f){return f&&!c.includes(f.id)}),a=t.getViewports(),s=a.findIndex(function(f){return f.id==="mapbox"}),u=a.length>1||s<0;(i||u)&&(s>=0&&(a=a.slice(),a[s]=mt(t,n,!1)),t._drawLayers("mapbox-repaint",{viewports:a,layerFilter:function(h){return(!t.props.layerFilter||t.props.layerFilter(h))&&(h.viewport.id!=="mapbox"||!c.includes(h.layer.id))},clearCanvas:!1}))}t.userData.currentViewport=null}function Ht(t,n){t.setProps({viewState:j(n)}),t.needsRedraw({clearRedrawFlags:!0})}function J(t){if(!t.userData.isExternal){var n=[];t.userData.mapboxLayers.forEach(function(r){var e=r.props.type,o=new e(r.props);n.push(o)}),t.setProps({layers:n})}}function $t(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var U=function(){function t(r){if($t(this,t),this.id=void 0,this.type=void 0,this.renderingMode=void 0,this.map=void 0,this.deck=void 0,this.props=void 0,!r.id)throw new Error("Layer must have an unique id");this.id=r.id,this.type="custom",this.renderingMode=r.renderingMode||"3d",this.map=null,this.deck=null,this.props=r}var n=t.prototype;return n.onAdd=function(e,o){this.map=e,this.deck=V({map:e,gl:o,deck:this.props.deck}),dt(this.deck,this)},n.onRemove=function(){this.deck&&ht(this.deck,this)},n.setProps=function(e){Object.assign(this.props,e,{id:this.id}),this.deck&&pt(this.deck,this)},n.render=function(){vt(this.deck,this.map,this)},t}();var w=k(L());var tt=k(L());function X(t,n){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Kt(t))||n&&t&&typeof t.length=="number"){r&&(t=r);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(s){throw s},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var c=!0,l=!1,i;return{s:function(){r=r.call(t)},n:function(){var s=r.next();return c=s.done,s},e:function(s){l=!0,i=s},f:function(){try{!c&&r.return!=null&&r.return()}finally{if(l)throw i}}}}function Kt(t,n){if(t){if(typeof t=="string")return gt(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gt(t,n)}}function gt(t,n){(n==null||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}var Q="__UNDEFINED__";function C(t,n,r,e){if(!(!t||!n||!t.style||!t.style._loaded)){var o=(0,tt._flatten)(e,Boolean);if(r!==e){var c=(0,tt._flatten)(r,Boolean),l=new Set(c.map(function(v){return v.id})),i=X(o),a;try{for(i.s();!(a=i.n()).done;){var s=a.value;l.delete(s.id)}}catch(v){i.e(v)}finally{i.f()}var u=X(l),f;try{for(u.s();!(f=u.n()).done;){var h=f.value;t.getLayer(h)&&t.removeLayer(h)}}catch(v){u.e(v)}finally{u.f()}}var _=X(o),A;try{for(_.s();!(A=_.n()).done;){var p=A.value,P=t.getLayer(p.id);P?P.implementation.setProps(p.props):t.addLayer(new U({id:p.id,deck:n}),p.props.beforeId)}}catch(v){_.e(v)}finally{_.f()}var M=t.style._order,y={},O=X(o),et;try{for(O.s();!(et=O.n()).done;){var nt=et.value,E=nt.props.beforeId;(!E||!M.includes(E))&&(E=Q),y[E]=y[E]||[],y[E].push(nt.id)}}catch(v){O.e(v)}finally{O.f()}for(var S in y)for(var rt=y[S],I=S===Q?M.length:M.indexOf(S),ot=S===Q?void 0:S,B=rt.length-1;B>=0;B--){var W=rt[B],it=M.indexOf(W);it!==I-1&&(t.moveLayer(W,ot),it>I&&I++),I--,ot=W}}}var Jt=["interleaved"];function Qt(t,n){if(t==null)return{};var r=te(t,n),e,o;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);for(o=0;o<c.length;o++)e=c[o],!(n.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function te(t,n){if(t==null)return{};var r={},e=Object.keys(t),o,c;for(c=0;c<e.length;c++)o=e[c],!(n.indexOf(o)>=0)&&(r[o]=t[o]);return r}function _t(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,e)}return r}function D(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?_t(Object(r),!0).forEach(function(e){ee(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_t(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function ee(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function ne(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var Mt=function(){function t(r){var e=this;ne(this,t),this._props=void 0,this._deck=void 0,this._map=void 0,this._container=void 0,this._interleaved=void 0,this._lastMouseDownPoint=void 0,this._handleStyleChange=function(){C(e._map,e._deck,e._props.layers,e._props.layers)},this._updateContainerSize=function(){if(e._map&&e._container){var i=e._map.getContainer(),a=i.clientWidth,s=i.clientHeight;Object.assign(e._container.style,{width:"".concat(a,"px"),height:"".concat(s,"px")})}},this._updateViewState=function(){var i=e._deck;i&&(i.setProps({viewState:j(e._map)}),i.isInitialized&&i.redraw())},this._handleMouseEvent=function(i){var a=e._deck;if(!(!a||!a.isInitialized)){var s={type:i.type,offsetCenter:i.point,srcEvent:i},u=e._lastMouseDownPoint;switch(!i.point&&u&&(s.deltaX=i.originalEvent.clientX-u.clientX,s.deltaY=i.originalEvent.clientY-u.clientY,s.offsetCenter={x:u.x+s.deltaX,y:u.y+s.deltaY}),s.type){case"mousedown":a._onPointerDown(s),e._lastMouseDownPoint=D(D({},i.point),{},{clientX:i.originalEvent.clientX,clientY:i.originalEvent.clientY});break;case"dragstart":s.type="panstart",a._onEvent(s);break;case"drag":s.type="panmove",a._onEvent(s);break;case"dragend":s.type="panend",a._onEvent(s);break;case"click":s.tapCount=1,a._onEvent(s);break;case"dblclick":s.type="click",s.tapCount=2,a._onEvent(s);break;case"mousemove":s.type="pointermove",a._onPointerMove(s);break;case"mouseout":s.type="pointerleave",a._onPointerMove(s);break;default:return}}};var o=r.interleaved,c=o===void 0?!1:o,l=Qt(r,Jt);this._interleaved=c,this._props=l}var n=t.prototype;return n.setProps=function(e){this._interleaved&&e.layers&&C(this._map,this._deck,this._props.layers,e.layers),Object.assign(this._props,e),this._deck&&this._deck.setProps(this._interleaved?K(this._props):this._props)},n.onAdd=function(e){return this._map=e,this._interleaved?this._onAddInterleaved(e):this._onAddOverlaid(e)},n._onAddOverlaid=function(e){var o=document.createElement("div");return Object.assign(o.style,{position:"absolute",left:0,top:0,pointerEvents:"none"}),this._container=o,this._deck=new w.Deck(D(D({},this._props),{},{parent:o,viewState:j(e)})),e.on("resize",this._updateContainerSize),e.on("render",this._updateViewState),e.on("mousedown",this._handleMouseEvent),e.on("dragstart",this._handleMouseEvent),e.on("drag",this._handleMouseEvent),e.on("dragend",this._handleMouseEvent),e.on("mousemove",this._handleMouseEvent),e.on("mouseout",this._handleMouseEvent),e.on("click",this._handleMouseEvent),e.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),o},n._onAddInterleaved=function(e){return this._deck=V({map:e,gl:e.painter.context.gl,deck:new w.Deck(D(D({},this._props),{},{gl:e.painter.context.gl}))}),e.on("styledata",this._handleStyleChange),C(e,this._deck,[],this._props.layers),document.createElement("div")},n.onRemove=function(){var e=this._map;e&&(this._interleaved?this._onRemoveInterleaved(e):this._onRemoveOverlaid(e)),this._deck=void 0,this._map=void 0,this._container=void 0},n._onRemoveOverlaid=function(e){var o;e.off("resize",this._updateContainerSize),e.off("render",this._updateViewState),e.off("mousedown",this._handleMouseEvent),e.off("dragstart",this._handleMouseEvent),e.off("drag",this._handleMouseEvent),e.off("dragend",this._handleMouseEvent),e.off("mousemove",this._handleMouseEvent),e.off("mouseout",this._handleMouseEvent),e.off("click",this._handleMouseEvent),e.off("dblclick",this._handleMouseEvent),(o=this._deck)===null||o===void 0||o.finalize()},n._onRemoveInterleaved=function(e){e.off("styledata",this._handleStyleChange),C(e,this._deck,this._props.layers,[]),$(e)},n.getDefaultPosition=function(){return"top-left"},n.pickObject=function(e){return(0,w.assert)(this._deck),this._deck.pickObject(e)},n.pickMultipleObjects=function(e){return(0,w.assert)(this._deck),this._deck.pickMultipleObjects(e)},n.pickObjects=function(e){return(0,w.assert)(this._deck),this._deck.pickObjects(e)},n.finalize=function(){this._map&&this._map.removeControl(this)},n.getCanvas=function(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null},t}();return Lt(z);})();
|
|
13
9
|
return __exports__;
|
|
14
10
|
});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@deck.gl/mapbox",
|
|
3
3
|
"description": "Use deck.gl layers as custom mapbox-gl-js layers",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "8.10.0-alpha.
|
|
5
|
+
"version": "8.10.0-alpha.7",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
34
|
"@luma.gl/constants": "^8.5.16",
|
|
35
|
-
"@math.gl/web-mercator": "^
|
|
35
|
+
"@math.gl/web-mercator": "^4.0.0",
|
|
36
36
|
"@types/mapbox-gl": "^2.6.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@deck.gl/core": "^8.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "1c62a9eec914019afd3969bc0c59f1488e491207"
|
|
42
42
|
}
|