@deck.gl/react 9.4.0-beta.1 → 9.4.0-beta.3

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/index.cjs CHANGED
@@ -663,12 +663,12 @@ function calculateViewportUniforms({
663
663
  }
664
664
  }
665
665
  if (viewport.projectionMode === PROJECTION_MODE.GLOBE && coordinateSystem === "meter-offsets") {
666
- const EARTH_RADIUS2 = 6370972;
667
- const GLOBE_RADIUS2 = 256;
666
+ const EARTH_RADIUS = 6370972;
667
+ const GLOBE_RADIUS = 256;
668
668
  const lambda = coordinateOrigin[0] * Math.PI / 180;
669
669
  const phi = coordinateOrigin[1] * Math.PI / 180;
670
670
  const cosPhi = Math.cos(phi);
671
- const D = ((coordinateOrigin[2] || 0) / EARTH_RADIUS2 + 1) * GLOBE_RADIUS2;
671
+ const D = ((coordinateOrigin[2] || 0) / EARTH_RADIUS + 1) * GLOBE_RADIUS;
672
672
  uniforms.commonOrigin = [
673
673
  Math.sin(lambda) * cosPhi * D,
674
674
  -Math.cos(lambda) * cosPhi * D,
@@ -856,7 +856,7 @@ fn project_mercator_(lnglat: vec2<f32>) -> vec2<f32> {
856
856
  let y = clamp(lnglat.y, -89.9, 89.9);
857
857
  return vec2<f32>(
858
858
  radians(x) + PI,
859
- PI + log(tan(PI * 0.25 + radians(y) * 0.5))
859
+ PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))
860
860
  ) * WORLD_SCALE;
861
861
  }
862
862
 
@@ -2706,8 +2706,8 @@ var _Viewport = class _Viewport {
2706
2706
  }
2707
2707
  return PROJECTION_MODE.IDENTITY;
2708
2708
  }
2709
- // Two viewports are equal if width and height are identical, and if
2710
- // their view and projection matrices are (approximately) equal.
2709
+ // Two viewports are equal if their dimensions, common-space scale, and
2710
+ // view and projection matrices are (approximately) equal.
2711
2711
  equals(viewport) {
2712
2712
  if (!(viewport instanceof _Viewport)) {
2713
2713
  return false;
@@ -2715,7 +2715,7 @@ var _Viewport = class _Viewport {
2715
2715
  if (this === viewport) {
2716
2716
  return true;
2717
2717
  }
2718
- return viewport.width === this.width && viewport.height === this.height && viewport.scale === this.scale && (0, import_core7.equals)(viewport.projectionMatrix, this.projectionMatrix) && (0, import_core7.equals)(viewport.viewMatrix, this.viewMatrix);
2718
+ return viewport.width === this.width && viewport.height === this.height && viewport.scale === this.scale && viewport.projectionMode === this.projectionMode && viewport.resolution === this.resolution && (0, import_core7.equals)(viewport.distanceScales.unitsPerMeter, this.distanceScales.unitsPerMeter) && (0, import_core7.equals)(viewport.projectionMatrix, this.projectionMatrix) && (0, import_core7.equals)(viewport.viewMatrix, this.viewMatrix);
2719
2719
  }
2720
2720
  /**
2721
2721
  * Projects xyz (possibly latitude and longitude) to pixel coordinates in window
@@ -3052,6 +3052,10 @@ var _WebMercatorViewport = class _WebMercatorViewport extends Viewport {
3052
3052
  }
3053
3053
  return this._subViewports;
3054
3054
  }
3055
+ /** Returns whether two Web Mercator viewports use the same projection settings. */
3056
+ equals(viewport) {
3057
+ return viewport instanceof _WebMercatorViewport && viewport._pseudoMeters === this._pseudoMeters && super.equals(viewport);
3058
+ }
3055
3059
  projectPosition(xyz) {
3056
3060
  if (this._pseudoMeters) {
3057
3061
  return super.projectPosition(xyz);
@@ -4565,7 +4569,7 @@ var View = class {
4565
4569
  };
4566
4570
 
4567
4571
  // ../core/src/controllers/map-controller.ts
4568
- var import_core15 = require("@math.gl/core");
4572
+ var import_core13 = require("@math.gl/core");
4569
4573
 
4570
4574
  // ../core/src/transitions/transition.ts
4571
4575
  var Transition = class {
@@ -4877,185 +4881,7 @@ var TransitionInterpolator = class {
4877
4881
  };
4878
4882
 
4879
4883
  // ../core/src/transitions/linear-interpolator.ts
4880
- var import_core14 = require("@math.gl/core");
4881
-
4882
- // ../core/src/viewports/globe-viewport.ts
4883
4884
  var import_core12 = require("@math.gl/core");
4884
- var import_web_mercator5 = require("@math.gl/web-mercator");
4885
- var import_core13 = require("@math.gl/core");
4886
- var import_web_mercator6 = require("@math.gl/web-mercator");
4887
- var DEGREES_TO_RADIANS2 = Math.PI / 180;
4888
- var RADIANS_TO_DEGREES = 180 / Math.PI;
4889
- var EARTH_RADIUS = 6370972;
4890
- var GLOBE_RADIUS = 256;
4891
- function getDistanceScales2() {
4892
- const unitsPerMeter2 = GLOBE_RADIUS / EARTH_RADIUS;
4893
- const unitsPerDegree = Math.PI / 180 * GLOBE_RADIUS;
4894
- return {
4895
- unitsPerMeter: [unitsPerMeter2, unitsPerMeter2, unitsPerMeter2],
4896
- unitsPerMeter2: [0, 0, 0],
4897
- metersPerUnit: [1 / unitsPerMeter2, 1 / unitsPerMeter2, 1 / unitsPerMeter2],
4898
- unitsPerDegree: [unitsPerDegree, unitsPerDegree, unitsPerMeter2],
4899
- unitsPerDegree2: [0, 0, 0],
4900
- degreesPerUnit: [1 / unitsPerDegree, 1 / unitsPerDegree, 1 / unitsPerMeter2]
4901
- };
4902
- }
4903
- var GlobeViewport = class extends Viewport {
4904
- constructor(opts = {}) {
4905
- const {
4906
- longitude = 0,
4907
- bearing = 0,
4908
- pitch = 0,
4909
- zoom = 0,
4910
- // Matches Maplibre defaults
4911
- // https://github.com/maplibre/maplibre-gl-js/blob/f8ab4b48d59ab8fe7b068b102538793bbdd4c848/src/geo/projection/globe_transform.ts#L632-L633
4912
- nearZMultiplier = 0.5,
4913
- farZMultiplier = 1,
4914
- resolution = 10
4915
- } = opts;
4916
- let { latitude = 0, height, altitude = 1.5, fovy } = opts;
4917
- latitude = Math.max(Math.min(latitude, 90), -90);
4918
- height = height || 1;
4919
- if (fovy) {
4920
- altitude = (0, import_web_mercator5.fovyToAltitude)(fovy);
4921
- } else {
4922
- fovy = (0, import_web_mercator5.altitudeToFovy)(altitude);
4923
- }
4924
- const scaleLatitude = Math.max(Math.min(latitude, import_web_mercator6.MAX_LATITUDE), -import_web_mercator6.MAX_LATITUDE);
4925
- const scale = Math.pow(2, zoom - zoomAdjust(scaleLatitude));
4926
- const pitchRadians = pitch * DEGREES_TO_RADIANS2;
4927
- const nearZ = opts.nearZ ?? nearZMultiplier;
4928
- const farZ = opts.farZ ?? (altitude + GLOBE_RADIUS * 2 * scale / height / Math.max(Math.cos(pitchRadians), 0.1)) * farZMultiplier;
4929
- const viewMatrix = new import_core12.Matrix4().lookAt({ eye: [0, -altitude, 0], up: [0, 0, 1] }).rotateX(-pitchRadians).rotateY(-bearing * DEGREES_TO_RADIANS2).rotateX(latitude * DEGREES_TO_RADIANS2).rotateZ(-longitude * DEGREES_TO_RADIANS2).scale(scale / height);
4930
- super({
4931
- ...opts,
4932
- // x, y, width,
4933
- height,
4934
- // view matrix
4935
- viewMatrix,
4936
- longitude,
4937
- latitude,
4938
- zoom,
4939
- // projection matrix parameters
4940
- distanceScales: getDistanceScales2(),
4941
- fovy,
4942
- focalDistance: altitude,
4943
- near: nearZ,
4944
- far: farZ
4945
- });
4946
- this.scale = scale;
4947
- this.latitude = latitude;
4948
- this.longitude = longitude;
4949
- this.bearing = bearing;
4950
- this.pitch = pitch;
4951
- this.fovy = fovy;
4952
- this.resolution = resolution;
4953
- }
4954
- get projectionMode() {
4955
- return PROJECTION_MODE.GLOBE;
4956
- }
4957
- getDistanceScales() {
4958
- return this.distanceScales;
4959
- }
4960
- getBounds(options = {}) {
4961
- const unprojectOption = { targetZ: options.z || 0 };
4962
- const left = this.unproject([0, this.height / 2], unprojectOption);
4963
- const top = this.unproject([this.width / 2, 0], unprojectOption);
4964
- const right = this.unproject([this.width, this.height / 2], unprojectOption);
4965
- const bottom = this.unproject([this.width / 2, this.height], unprojectOption);
4966
- if (right[0] < this.longitude) right[0] += 360;
4967
- if (left[0] > this.longitude) left[0] -= 360;
4968
- return [
4969
- Math.min(left[0], right[0], top[0], bottom[0]),
4970
- Math.min(left[1], right[1], top[1], bottom[1]),
4971
- Math.max(left[0], right[0], top[0], bottom[0]),
4972
- Math.max(left[1], right[1], top[1], bottom[1])
4973
- ];
4974
- }
4975
- unproject(xyz, { topLeft = true, targetZ } = {}) {
4976
- const [x, y, z] = xyz;
4977
- const y2 = topLeft ? y : this.height - y;
4978
- const { pixelUnprojectionMatrix } = this;
4979
- let coord;
4980
- if (Number.isFinite(z)) {
4981
- coord = transformVector(pixelUnprojectionMatrix, [x, y2, z, 1]);
4982
- } else {
4983
- const coord0 = transformVector(pixelUnprojectionMatrix, [x, y2, -1, 1]);
4984
- const coord1 = transformVector(pixelUnprojectionMatrix, [x, y2, 1, 1]);
4985
- const lt = ((targetZ || 0) / EARTH_RADIUS + 1) * GLOBE_RADIUS;
4986
- const lSqr = import_core13.vec3.sqrLen(import_core13.vec3.sub([], coord0, coord1));
4987
- const l0Sqr = import_core13.vec3.sqrLen(coord0);
4988
- const l1Sqr = import_core13.vec3.sqrLen(coord1);
4989
- const sSqr = (4 * l0Sqr * l1Sqr - (lSqr - l0Sqr - l1Sqr) ** 2) / 16;
4990
- const dSqr = 4 * sSqr / lSqr;
4991
- const r0 = Math.sqrt(l0Sqr - dSqr);
4992
- const dr = Math.sqrt(Math.max(0, lt * lt - dSqr));
4993
- const t = (r0 - dr) / Math.sqrt(lSqr);
4994
- coord = import_core13.vec3.lerp([], coord0, coord1, t);
4995
- }
4996
- const [X, Y, Z] = this.unprojectPosition(coord);
4997
- if (Number.isFinite(z)) {
4998
- return [X, Y, Z];
4999
- }
5000
- return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y];
5001
- }
5002
- projectPosition(xyz) {
5003
- const [lng, lat, Z = 0] = xyz;
5004
- const lambda = lng * DEGREES_TO_RADIANS2;
5005
- const phi = lat * DEGREES_TO_RADIANS2;
5006
- const cosPhi = Math.cos(phi);
5007
- const D = (Z / EARTH_RADIUS + 1) * GLOBE_RADIUS;
5008
- return [Math.sin(lambda) * cosPhi * D, -Math.cos(lambda) * cosPhi * D, Math.sin(phi) * D];
5009
- }
5010
- unprojectPosition(xyz) {
5011
- const [x, y, z] = xyz;
5012
- const D = import_core13.vec3.len(xyz);
5013
- const phi = Math.asin(z / D);
5014
- const lambda = Math.atan2(x, -y);
5015
- const lng = lambda * RADIANS_TO_DEGREES;
5016
- const lat = phi * RADIANS_TO_DEGREES;
5017
- const Z = (D / GLOBE_RADIUS - 1) * EARTH_RADIUS;
5018
- return [lng, lat, Z];
5019
- }
5020
- projectFlat(xyz) {
5021
- return xyz;
5022
- }
5023
- unprojectFlat(xyz) {
5024
- return xyz;
5025
- }
5026
- /**
5027
- * Pan the globe using delta-based movement
5028
- * @param coords - the geographic coordinates where the pan started
5029
- * @param pixel - the current screen position
5030
- * @param startPixel - the screen position where the pan started
5031
- * @returns updated viewport options with new longitude/latitude
5032
- */
5033
- panByPosition([startLng, startLat, startZoom], pixel, startPixel) {
5034
- const scale = Math.pow(2, this.zoom - zoomAdjust(this.latitude));
5035
- const rotationSpeed = 0.25 / scale;
5036
- const longitude = startLng + rotationSpeed * (startPixel[0] - pixel[0]);
5037
- let latitude = startLat - rotationSpeed * (startPixel[1] - pixel[1]);
5038
- latitude = Math.max(Math.min(latitude, 90), -90);
5039
- const out = { longitude, latitude, zoom: startZoom - zoomAdjust(startLat) };
5040
- out.zoom += zoomAdjust(out.latitude);
5041
- return out;
5042
- }
5043
- };
5044
- GlobeViewport.displayName = "GlobeViewport";
5045
- function zoomAdjust(latitude, clampToPoles) {
5046
- if (clampToPoles) {
5047
- latitude = Math.max(Math.min(latitude, import_web_mercator6.MAX_LATITUDE), -import_web_mercator6.MAX_LATITUDE);
5048
- }
5049
- const scaleAdjust = Math.PI * Math.cos(latitude * Math.PI / 180);
5050
- return Math.log2(scaleAdjust);
5051
- }
5052
- function transformVector(matrix, vector) {
5053
- const result = import_core13.vec4.transformMat4([], vector, matrix);
5054
- import_core13.vec4.scale(result, result, 1 / result[3]);
5055
- return result;
5056
- }
5057
-
5058
- // ../core/src/transitions/linear-interpolator.ts
5059
4885
  var DEFAULT_PROPS = ["longitude", "latitude", "zoom", "bearing", "pitch"];
5060
4886
  var DEFAULT_REQUIRED_PROPS = ["longitude", "latitude", "zoom"];
5061
4887
  var LinearInterpolator = class extends TransitionInterpolator {
@@ -5082,28 +4908,23 @@ var LinearInterpolator = class extends TransitionInterpolator {
5082
4908
  const result = super.initializeProps(startProps, endProps);
5083
4909
  const { makeViewport, around } = this.opts;
5084
4910
  if (makeViewport && around) {
5085
- const TestViewport = makeViewport(startProps);
5086
- if (TestViewport instanceof GlobeViewport) {
5087
- log_default.warn("around not supported in GlobeView")();
5088
- } else {
5089
- const startViewport = makeViewport(startProps);
5090
- const endViewport = makeViewport(endProps);
5091
- const aroundPosition = startViewport.unproject(around);
5092
- result.start.around = around;
5093
- Object.assign(result.end, {
5094
- around: endViewport.project(aroundPosition),
5095
- aroundPosition,
5096
- width: endProps.width,
5097
- height: endProps.height
5098
- });
5099
- }
4911
+ const startViewport = makeViewport(startProps);
4912
+ const endViewport = makeViewport(endProps);
4913
+ const aroundPosition = startViewport.unproject(around);
4914
+ result.start.around = around;
4915
+ Object.assign(result.end, {
4916
+ around: endViewport.project(aroundPosition),
4917
+ aroundPosition,
4918
+ width: endProps.width,
4919
+ height: endProps.height
4920
+ });
5100
4921
  }
5101
4922
  return result;
5102
4923
  }
5103
4924
  interpolateProps(startProps, endProps, t) {
5104
4925
  const propsInTransition = {};
5105
4926
  for (const key of this._propsToExtract) {
5106
- propsInTransition[key] = (0, import_core14.lerp)(startProps[key] || 0, endProps[key] || 0, t);
4927
+ propsInTransition[key] = (0, import_core12.lerp)(startProps[key] || 0, endProps[key] || 0, t);
5107
4928
  }
5108
4929
  if (endProps.aroundPosition && this.opts.makeViewport) {
5109
4930
  const viewport = this.opts.makeViewport({ ...endProps, ...propsInTransition });
@@ -5112,7 +4933,7 @@ var LinearInterpolator = class extends TransitionInterpolator {
5112
4933
  viewport.panByPosition(
5113
4934
  endProps.aroundPosition,
5114
4935
  // anchor point in current screen coordinates
5115
- (0, import_core14.lerp)(startProps.around, endProps.around, t)
4936
+ (0, import_core12.lerp)(startProps.around, endProps.around, t)
5116
4937
  )
5117
4938
  );
5118
4939
  }
@@ -5121,6 +4942,7 @@ var LinearInterpolator = class extends TransitionInterpolator {
5121
4942
  };
5122
4943
 
5123
4944
  // ../core/src/controllers/controller.ts
4945
+ var import_web_mercator5 = require("@math.gl/web-mercator");
5124
4946
  var NO_TRANSITION_PROPS = {
5125
4947
  transitionDuration: 0
5126
4948
  };
@@ -5169,6 +4991,7 @@ var Controller = class {
5169
4991
  this.touchRotate = false;
5170
4992
  this.multiTouchDrag = null;
5171
4993
  this.trackpadGesture = false;
4994
+ this.zoomAround = "pointer";
5172
4995
  this.keyboard = true;
5173
4996
  this.transitionManager = new TransitionManager({
5174
4997
  ...opts,
@@ -5263,6 +5086,15 @@ var Controller = class {
5263
5086
  const { offsetCenter } = event;
5264
5087
  return [offsetCenter.x - x, offsetCenter.y - y];
5265
5088
  }
5089
+ /** Resolves the zoom anchor for pointer-based controls. */
5090
+ getZoomPosition(position) {
5091
+ if (this.zoomAround === "pointer") {
5092
+ return position;
5093
+ }
5094
+ const viewport = this.makeViewport(this.controllerState.getViewportProps());
5095
+ const [centerX, centerY] = (0, import_web_mercator5.worldToPixels)(viewport.center, viewport.pixelProjectionMatrix);
5096
+ return [centerX, centerY];
5097
+ }
5266
5098
  isPointInBounds(pos, event) {
5267
5099
  const { width, height } = this.props;
5268
5100
  if (event && event.handled) {
@@ -5320,6 +5152,7 @@ var Controller = class {
5320
5152
  touchRotate = false,
5321
5153
  multiTouchDrag = touchRotate ? "rotate" : null,
5322
5154
  trackpadGesture = false,
5155
+ zoomAround = "pointer",
5323
5156
  keyboard = true
5324
5157
  } = props;
5325
5158
  const isInteractive = Boolean(this.onViewStateChange);
@@ -5342,6 +5175,7 @@ var Controller = class {
5342
5175
  this.touchRotate = multiTouchDrag === "rotate";
5343
5176
  this.multiTouchDrag = multiTouchDrag;
5344
5177
  this.trackpadGesture = trackpadGesture;
5178
+ this.zoomAround = zoomAround;
5345
5179
  this.keyboard = keyboard;
5346
5180
  const constraintChanged = !oldProps || oldProps.height !== props.height || oldProps.width !== props.width || oldProps.maxBounds !== props.maxBounds || oldProps.maxBoundsPadding !== props.maxBoundsPadding;
5347
5181
  if (constraintChanged && props.maxBounds) {
@@ -5575,8 +5409,9 @@ var Controller = class {
5575
5409
  if (delta < 0 && scale !== 0) {
5576
5410
  scale = 1 / scale;
5577
5411
  }
5578
- const transitionProps = smooth ? { ...this._getTransitionProps({ around: pos }), transitionDuration: 250 } : NO_TRANSITION_PROPS;
5579
- const newControllerState = this.controllerState.zoom({ pos, scale });
5412
+ const zoomPosition = this.getZoomPosition(pos);
5413
+ const transitionProps = smooth ? { ...this._getTransitionProps({ around: zoomPosition }), transitionDuration: 250 } : NO_TRANSITION_PROPS;
5414
+ const newControllerState = this.controllerState.zoom({ pos: zoomPosition, scale });
5580
5415
  this.updateViewport(newControllerState, transitionProps, {
5581
5416
  isZooming: true,
5582
5417
  isPanning: true
@@ -5662,7 +5497,7 @@ var Controller = class {
5662
5497
  if (!this.isPointInBounds(pos, event)) {
5663
5498
  return false;
5664
5499
  }
5665
- const newControllerState = this.controllerState.zoomStart({ pos }, this._getConstraintContext("zoom", "start")).rotateStart({ pos }, this._getConstraintContext("rotate", "start"));
5500
+ const newControllerState = this.controllerState.zoomStart({ pos: this.getZoomPosition(pos) }, this._getConstraintContext("zoom", "start")).rotateStart({ pos }, this._getConstraintContext("rotate", "start"));
5666
5501
  pinchEventWorkaround._startPinchRotation = event.rotation;
5667
5502
  pinchEventWorkaround._lastPinchEvent = event;
5668
5503
  this.updateViewport(newControllerState, NO_TRANSITION_PROPS, { isDragging: true });
@@ -5681,7 +5516,7 @@ var Controller = class {
5681
5516
  const { scale } = event;
5682
5517
  const pos = this.getCenter(event);
5683
5518
  newControllerState = newControllerState.zoom(
5684
- { pos, scale },
5519
+ { pos: this.getZoomPosition(pos), scale },
5685
5520
  this._getConstraintContext("zoom", "update")
5686
5521
  );
5687
5522
  }
@@ -5709,15 +5544,16 @@ var Controller = class {
5709
5544
  const { _lastPinchEvent } = pinchEventWorkaround;
5710
5545
  if (this.touchZoom && inertia && _lastPinchEvent && event.scale !== _lastPinchEvent.scale) {
5711
5546
  const pos = this.getCenter(event);
5547
+ const zoomPosition = this.getZoomPosition(pos);
5712
5548
  let newControllerState = this.controllerState.rotateEnd();
5713
5549
  const z = Math.log2(event.scale);
5714
5550
  const velocityZ = (z - Math.log2(_lastPinchEvent.scale)) / (event.deltaTime - _lastPinchEvent.deltaTime);
5715
5551
  const endScale = Math.pow(2, z + velocityZ * inertia / 2);
5716
- newControllerState = newControllerState.zoom({ pos, scale: endScale }).zoomEnd();
5552
+ newControllerState = newControllerState.zoom({ pos: zoomPosition, scale: endScale }).zoomEnd();
5717
5553
  this.updateViewport(
5718
5554
  newControllerState,
5719
5555
  {
5720
- ...this._getTransitionProps({ around: pos }),
5556
+ ...this._getTransitionProps({ around: zoomPosition }),
5721
5557
  transitionDuration: inertia,
5722
5558
  transitionEasing: INERTIA_EASING
5723
5559
  },
@@ -5762,8 +5598,12 @@ var Controller = class {
5762
5598
  return false;
5763
5599
  }
5764
5600
  const isZoomOut = this.isFunctionKeyPressed(event);
5765
- const newControllerState = this.controllerState.zoom({ pos, scale: isZoomOut ? 0.5 : 2 });
5766
- this.updateViewport(newControllerState, this._getTransitionProps({ around: pos }), {
5601
+ const zoomPosition = this.getZoomPosition(pos);
5602
+ const newControllerState = this.controllerState.zoom({
5603
+ pos: zoomPosition,
5604
+ scale: isZoomOut ? 0.5 : 2
5605
+ });
5606
+ this.updateViewport(newControllerState, this._getTransitionProps({ around: zoomPosition }), {
5767
5607
  isZooming: true,
5768
5608
  isPanning: true
5769
5609
  });
@@ -5780,14 +5620,14 @@ var Controller = class {
5780
5620
  this._doubleClickDragAnchor = null;
5781
5621
  return false;
5782
5622
  }
5783
- this._doubleClickDragAnchor = pos;
5623
+ this._doubleClickDragAnchor = this.getZoomPosition(pos);
5784
5624
  let newControllerState = this.controllerState.zoomStart(
5785
- { pos },
5625
+ { pos: this._doubleClickDragAnchor },
5786
5626
  this._getConstraintContext("zoom", "start")
5787
5627
  );
5788
5628
  if (event.scale !== 1) {
5789
5629
  newControllerState = newControllerState.zoom(
5790
- { pos, scale: event.scale },
5630
+ { pos: this._doubleClickDragAnchor, scale: event.scale },
5791
5631
  this._getConstraintContext("zoom", "update")
5792
5632
  );
5793
5633
  }
@@ -5956,7 +5796,7 @@ function getMaxBoundsExtents(viewport, target, rect) {
5956
5796
  }
5957
5797
 
5958
5798
  // ../core/src/controllers/map-controller.ts
5959
- var import_web_mercator7 = require("@math.gl/web-mercator");
5799
+ var import_web_mercator6 = require("@math.gl/web-mercator");
5960
5800
  var PITCH_MOUSE_THRESHOLD = 5;
5961
5801
  var PITCH_ACCEL = 1.2;
5962
5802
  var WEB_MERCATOR_TILE_SIZE = 512;
@@ -5970,11 +5810,11 @@ function lngLatToWorld2([lng, lat]) {
5970
5810
  lat = Math.sign(lat) * 90;
5971
5811
  }
5972
5812
  if (Number.isFinite(lng)) {
5973
- const [x, y2] = (0, import_web_mercator7.lngLatToWorld)([lng, lat]);
5974
- return [x, (0, import_core15.clamp)(y2, 0, WEB_MERCATOR_TILE_SIZE)];
5813
+ const [x, y2] = (0, import_web_mercator6.lngLatToWorld)([lng, lat]);
5814
+ return [x, (0, import_core13.clamp)(y2, 0, WEB_MERCATOR_TILE_SIZE)];
5975
5815
  }
5976
- const [, y] = (0, import_web_mercator7.lngLatToWorld)([0, lat]);
5977
- return [lng, (0, import_core15.clamp)(y, 0, WEB_MERCATOR_TILE_SIZE)];
5816
+ const [, y] = (0, import_web_mercator6.lngLatToWorld)([0, lat]);
5817
+ return [lng, (0, import_core13.clamp)(y, 0, WEB_MERCATOR_TILE_SIZE)];
5978
5818
  }
5979
5819
  var MapState = class extends ViewState {
5980
5820
  constructor(options) {
@@ -6283,7 +6123,7 @@ var MapState = class extends ViewState {
6283
6123
  props.bearing = mod(bearing + 180, 360) - 180;
6284
6124
  }
6285
6125
  }
6286
- props.pitch = (0, import_core15.clamp)(pitch, minPitch, maxPitch);
6126
+ props.pitch = (0, import_core13.clamp)(pitch, minPitch, maxPitch);
6287
6127
  const constrainedZoom = this._constrainZoom(props.zoom, props);
6288
6128
  const shouldRubberBand = rubberBand && (constraintContext == null ? void 0 : constraintContext.mode) === "elastic";
6289
6129
  props.zoom = (constraintContext == null ? void 0 : constraintContext.mode) === "preserve" ? props.zoom : shouldRubberBand ? applyRubberBand(props.zoom, constrainedZoom, ZOOM_RUBBER_BAND_RANGE) : constrainedZoom;
@@ -6318,8 +6158,8 @@ var MapState = class extends ViewState {
6318
6158
  ];
6319
6159
  const center = lngLatToWorld2([props.longitude, props.latitude]);
6320
6160
  const constrainedCenter = [
6321
- (0, import_core15.clamp)(center[0], minimumCenter[0], maximumCenter[0]),
6322
- (0, import_core15.clamp)(center[1], minimumCenter[1], maximumCenter[1])
6161
+ (0, import_core13.clamp)(center[0], minimumCenter[0], maximumCenter[0]),
6162
+ (0, import_core13.clamp)(center[1], minimumCenter[1], maximumCenter[1])
6323
6163
  ];
6324
6164
  const displayedCenter = center.slice();
6325
6165
  if (maxBoundsRect.width >= 0) {
@@ -6329,7 +6169,7 @@ var MapState = class extends ViewState {
6329
6169
  displayedCenter[1] = (constraintContext == null ? void 0 : constraintContext.mode) === "preserve" ? center[1] : shouldRubberBand ? applyRubberBand(center[1], constrainedCenter[1], maxBoundsRect.height / 2 / scale) : constrainedCenter[1];
6330
6170
  }
6331
6171
  if (displayedCenter[0] !== center[0] || displayedCenter[1] !== center[1]) {
6332
- const [displayedLongitude, displayedLatitude] = (0, import_web_mercator7.worldToLngLat)(displayedCenter);
6172
+ const [displayedLongitude, displayedLatitude] = (0, import_web_mercator6.worldToLngLat)(displayedCenter);
6333
6173
  if (displayedCenter[0] !== center[0]) {
6334
6174
  props.longitude = displayedLongitude;
6335
6175
  }
@@ -6360,7 +6200,7 @@ var MapState = class extends ViewState {
6360
6200
  }
6361
6201
  if (minZoom > maxZoom) minZoom = maxZoom;
6362
6202
  }
6363
- return (0, import_core15.clamp)(zoom, minZoom, maxZoom);
6203
+ return (0, import_core13.clamp)(zoom, minZoom, maxZoom);
6364
6204
  }
6365
6205
  _zoomFromCenter(scale, constraintContext) {
6366
6206
  const { width, height } = this.getViewportProps();
@@ -6416,7 +6256,7 @@ var MapState = class extends ViewState {
6416
6256
  deltaScaleY = 1 - centerY / startY;
6417
6257
  }
6418
6258
  }
6419
- deltaScaleY = (0, import_core15.clamp)(deltaScaleY, -1, 1);
6259
+ deltaScaleY = (0, import_core13.clamp)(deltaScaleY, -1, 1);
6420
6260
  const { minPitch, maxPitch } = this.getViewportProps();
6421
6261
  const bearing = startBearing + 180 * deltaScaleX;
6422
6262
  let pitch = startPitch;
@@ -6745,7 +6585,7 @@ var DeckRenderer = class {
6745
6585
  };
6746
6586
 
6747
6587
  // ../core/src/lib/deck-picker.ts
6748
- var import_core16 = require("@luma.gl/core");
6588
+ var import_core14 = require("@luma.gl/core");
6749
6589
 
6750
6590
  // ../core/src/lib/picking/query-object.ts
6751
6591
  var NO_PICKED_OBJECT = {
@@ -7014,7 +6854,7 @@ var DeckPicker = class {
7014
6854
  format: "rgba8unorm",
7015
6855
  width: 1,
7016
6856
  height: 1,
7017
- usage: import_core16.Texture.RENDER_ATTACHMENT | import_core16.Texture.COPY_SRC
6857
+ usage: import_core14.Texture.RENDER_ATTACHMENT | import_core14.Texture.COPY_SRC
7018
6858
  });
7019
6859
  this.pickingFBO = this.device.createFramebuffer({
7020
6860
  colorAttachments: [pickingColorTexture],
@@ -7025,7 +6865,7 @@ var DeckPicker = class {
7025
6865
  format: "rgba32float",
7026
6866
  width: 1,
7027
6867
  height: 1,
7028
- usage: import_core16.Texture.RENDER_ATTACHMENT | import_core16.Texture.COPY_SRC
6868
+ usage: import_core14.Texture.RENDER_ATTACHMENT | import_core14.Texture.COPY_SRC
7029
6869
  });
7030
6870
  const depthFBO = this.device.createFramebuffer({
7031
6871
  colorAttachments: [depthColorTexture],
@@ -7543,7 +7383,7 @@ var DeckPicker = class {
7543
7383
  const layout = texture.computeMemoryLayout(options);
7544
7384
  const readBuffer = this.device.createBuffer({
7545
7385
  byteLength: layout.byteLength,
7546
- usage: import_core16.Buffer.COPY_DST | import_core16.Buffer.MAP_READ
7386
+ usage: import_core14.Buffer.COPY_DST | import_core14.Buffer.MAP_READ
7547
7387
  });
7548
7388
  try {
7549
7389
  texture.readBuffer(options, readBuffer);
@@ -8268,7 +8108,7 @@ var CanvasManager = class {
8268
8108
  };
8269
8109
 
8270
8110
  // ../core/src/lib/deck.ts
8271
- var import_core17 = require("@luma.gl/core");
8111
+ var import_core15 = require("@luma.gl/core");
8272
8112
  var import_webgl = require("@luma.gl/webgl");
8273
8113
 
8274
8114
  // ../../node_modules/@luma.gl/webgl/dist/constants/webgl-constants.js
@@ -9886,7 +9726,7 @@ var Deck = class {
9886
9726
  // we must use 'premultiplied' canvas for webgpu to enable transparency and match shaders
9887
9727
  alphaMode: ((_b = this.props.deviceProps) == null ? void 0 : _b.type) === "webgpu" ? "premultiplied" : void 0
9888
9728
  };
9889
- return import_core17.luma.createDevice({
9729
+ return import_core15.luma.createDevice({
9890
9730
  // luma by default throws if a device is already attached
9891
9731
  // asynchronous device creation could happen after finalize() is called
9892
9732
  // TODO - createDevice should support AbortController?
@@ -10167,7 +10007,7 @@ var Deck = class {
10167
10007
  metrics.cpuTime = stats.get("CPU Time").time;
10168
10008
  metrics.gpuTimePerFrame = stats.get("GPU Time").getAverageTime();
10169
10009
  metrics.cpuTimePerFrame = stats.get("CPU Time").getAverageTime();
10170
- const memoryStats = import_core17.luma.stats.get("GPU Time and Memory");
10010
+ const memoryStats = import_core15.luma.stats.get("GPU Time and Memory");
10171
10011
  metrics.bufferMemory = memoryStats.get("Buffer Memory").count;
10172
10012
  metrics.textureMemory = memoryStats.get("Texture Memory").count;
10173
10013
  metrics.renderbufferMemory = memoryStats.get("Renderbuffer Memory").count;
@@ -10180,10 +10020,10 @@ Deck.defaultProps = defaultProps;
10180
10020
  Deck.VERSION = VERSION;
10181
10021
 
10182
10022
  // ../core/src/lib/attribute/data-column.ts
10183
- var import_core19 = require("@luma.gl/core");
10023
+ var import_core17 = require("@luma.gl/core");
10184
10024
 
10185
10025
  // ../core/src/lib/attribute/gl-utils.ts
10186
- var import_core18 = require("@luma.gl/core");
10026
+ var import_core16 = require("@luma.gl/core");
10187
10027
  function typedArrayFromDataType(type) {
10188
10028
  switch (type) {
10189
10029
  case "float64":
@@ -10192,10 +10032,10 @@ function typedArrayFromDataType(type) {
10192
10032
  case "unorm8":
10193
10033
  return Uint8ClampedArray;
10194
10034
  default:
10195
- return (0, import_core18.getTypedArrayConstructor)(type);
10035
+ return (0, import_core16.getTypedArrayConstructor)(type);
10196
10036
  }
10197
10037
  }
10198
- var dataTypeFromTypedArray = import_core18.dataTypeDecoder.getDataType.bind(import_core18.dataTypeDecoder);
10038
+ var dataTypeFromTypedArray = import_core16.dataTypeDecoder.getDataType.bind(import_core16.dataTypeDecoder);
10199
10039
  function getBufferAttributeLayout(name, accessor, deviceType) {
10200
10040
  if (accessor.size > 4) {
10201
10041
  return null;
@@ -10326,6 +10166,7 @@ var DataColumn = class {
10326
10166
  this._buffer = null;
10327
10167
  }
10328
10168
  typed_array_manager_default.release(this.state.allocatedValue);
10169
+ this.state.allocatedValue = null;
10329
10170
  }
10330
10171
  getBuffer() {
10331
10172
  if (this.state.constant && this.device.type !== "webgpu") {
@@ -10445,7 +10286,7 @@ var DataColumn = class {
10445
10286
  let opts;
10446
10287
  if (ArrayBuffer.isView(data)) {
10447
10288
  opts = { value: data };
10448
- } else if (data instanceof import_core19.Buffer) {
10289
+ } else if (data instanceof import_core17.Buffer) {
10449
10290
  opts = { buffer: data };
10450
10291
  } else {
10451
10292
  opts = data;
@@ -10645,7 +10486,7 @@ var DataColumn = class {
10645
10486
  this._buffer.destroy();
10646
10487
  }
10647
10488
  const { isIndexed, type } = this.settings;
10648
- const usage = this.device.type === "webgpu" && !isIndexed ? import_core19.Buffer.VERTEX | import_core19.Buffer.STORAGE | import_core19.Buffer.COPY_DST | import_core19.Buffer.COPY_SRC : (isIndexed ? import_core19.Buffer.INDEX : import_core19.Buffer.VERTEX) | import_core19.Buffer.COPY_DST;
10489
+ const usage = this.device.type === "webgpu" && !isIndexed ? import_core17.Buffer.VERTEX | import_core17.Buffer.STORAGE | import_core17.Buffer.COPY_DST | import_core17.Buffer.COPY_SRC : (isIndexed ? import_core17.Buffer.INDEX : import_core17.Buffer.VERTEX) | import_core17.Buffer.COPY_DST;
10649
10490
  this._buffer = this.device.createBuffer({
10650
10491
  ...(_a = this._buffer) == null ? void 0 : _a.props,
10651
10492
  id: this.id,
@@ -11275,6 +11116,7 @@ ${getComputeBlock(module2.name, inputEntries, output, elementWise, expression)}
11275
11116
  );
11276
11117
  const computation = new import_engine4.Computation(outputBuffer.device, {
11277
11118
  source: source2,
11119
+ modules: module2.dependencies,
11278
11120
  shaderAssembler: GPGPU_SHADER_ASSEMBLER,
11279
11121
  shaderLayout: {
11280
11122
  bindings: [
@@ -12666,11 +12508,11 @@ var AttributeManager = class {
12666
12508
  };
12667
12509
 
12668
12510
  // ../core/src/lib/layer.ts
12669
- var import_core22 = require("@luma.gl/core");
12511
+ var import_core20 = require("@luma.gl/core");
12670
12512
  var import_webgl2 = require("@luma.gl/webgl");
12671
12513
 
12672
12514
  // ../core/src/transitions/cpu-interpolation-transition.ts
12673
- var import_core20 = require("@math.gl/core");
12515
+ var import_core18 = require("@math.gl/core");
12674
12516
  var CPUInterpolationTransition = class extends Transition {
12675
12517
  get value() {
12676
12518
  return this._value;
@@ -12681,7 +12523,7 @@ var CPUInterpolationTransition = class extends Transition {
12681
12523
  settings: { fromValue, toValue, duration, easing }
12682
12524
  } = this;
12683
12525
  const t = easing(time / duration);
12684
- this._value = (0, import_core20.lerp)(fromValue, toValue, t);
12526
+ this._value = (0, import_core18.lerp)(fromValue, toValue, t);
12685
12527
  }
12686
12528
  };
12687
12529
 
@@ -13041,7 +12883,7 @@ function mergeShaders(target, source2) {
13041
12883
  }
13042
12884
 
13043
12885
  // ../core/src/utils/texture.ts
13044
- var import_core21 = require("@luma.gl/core");
12886
+ var import_core19 = require("@luma.gl/core");
13045
12887
  var DEFAULT_TEXTURE_PARAMETERS = {
13046
12888
  minFilter: "linear",
13047
12889
  mipmapFilter: "linear",
@@ -13051,7 +12893,7 @@ var DEFAULT_TEXTURE_PARAMETERS = {
13051
12893
  };
13052
12894
  var internalTextures = {};
13053
12895
  function createTexture(owner, device, image, sampler) {
13054
- if (image instanceof import_core21.Texture) {
12896
+ if (image instanceof import_core19.Texture) {
13055
12897
  return image;
13056
12898
  } else if (image.constructor && image.constructor.name !== "Object") {
13057
12899
  image = { data: image };
@@ -13082,7 +12924,7 @@ function createTexture(owner, device, image, sampler) {
13082
12924
  return texture;
13083
12925
  }
13084
12926
  function destroyTexture(owner, texture) {
13085
- if (!texture || !(texture instanceof import_core21.Texture)) {
12927
+ if (!texture || !(texture instanceof import_core19.Texture)) {
13086
12928
  return;
13087
12929
  }
13088
12930
  if (internalTextures[texture.id] === owner) {
@@ -13710,8 +13552,8 @@ var LayerState = class extends ComponentState {
13710
13552
  };
13711
13553
 
13712
13554
  // ../core/src/lib/layer.ts
13713
- var import_web_mercator8 = require("@math.gl/web-mercator");
13714
- var import_core23 = require("@loaders.gl/core");
13555
+ var import_web_mercator7 = require("@math.gl/web-mercator");
13556
+ var import_core21 = require("@loaders.gl/core");
13715
13557
  var TRACE_CHANGE_FLAG = "layer.changeFlag";
13716
13558
  var TRACE_INITIALIZE = "layer.initialize";
13717
13559
  var TRACE_UPDATE = "layer.update";
@@ -13774,7 +13616,7 @@ var defaultProps2 = {
13774
13616
  }
13775
13617
  let inResourceManager = resourceManager.contains(url);
13776
13618
  if (!inResourceManager && !loadOptions) {
13777
- resourceManager.add({ resourceId: url, data: (0, import_core23.load)(url, loaders), persistent: false });
13619
+ resourceManager.add({ resourceId: url, data: (0, import_core21.load)(url, loaders), persistent: false });
13778
13620
  inResourceManager = true;
13779
13621
  }
13780
13622
  if (inResourceManager) {
@@ -13788,7 +13630,7 @@ var defaultProps2 = {
13788
13630
  requestId: propName
13789
13631
  });
13790
13632
  }
13791
- return (0, import_core23.load)(url, loaders, loadOptions);
13633
+ return (0, import_core21.load)(url, loaders, loadOptions);
13792
13634
  }
13793
13635
  },
13794
13636
  updateTriggers: {},
@@ -13858,7 +13700,7 @@ var Layer = class extends Component {
13858
13700
  coordinateOrigin: this.props.coordinateOrigin,
13859
13701
  coordinateSystem: this.props.coordinateSystem
13860
13702
  });
13861
- const [x, y, z] = (0, import_web_mercator8.worldToPixels)(worldPosition, viewport.pixelProjectionMatrix);
13703
+ const [x, y, z] = (0, import_web_mercator7.worldToPixels)(worldPosition, viewport.pixelProjectionMatrix);
13862
13704
  return xyz.length === 2 ? [x, y] : [x, y, z];
13863
13705
  }
13864
13706
  /** Unprojects a screen pixel to the current view's default coordinate system
@@ -14269,7 +14111,7 @@ var Layer = class extends Component {
14269
14111
  const values = changedAttributes[name].getValue();
14270
14112
  for (const attributeName in values) {
14271
14113
  const value = values[attributeName];
14272
- if (value instanceof import_core22.Buffer) {
14114
+ if (value instanceof import_core20.Buffer) {
14273
14115
  if (changedAttributes[name].settings.isIndexed) {
14274
14116
  model.setIndexBuffer(value);
14275
14117
  } else {
@@ -14304,7 +14146,7 @@ var Layer = class extends Component {
14304
14146
  const values = attribute.getValue();
14305
14147
  for (const attributeName in values) {
14306
14148
  const value = values[attributeName];
14307
- if (value instanceof import_core22.Buffer) {
14149
+ if (value instanceof import_core20.Buffer) {
14308
14150
  if (attribute.settings.isIndexed) {
14309
14151
  model.setIndexBuffer(value);
14310
14152
  } else {