deck.gl 9.2.9 → 9.2.11

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.
Files changed (3) hide show
  1. package/dist/dist.dev.js +85 -39
  2. package/dist.min.js +226 -224
  3. package/package.json +18 -18
package/dist/dist.dev.js CHANGED
@@ -49303,7 +49303,7 @@ void main(void) {
49303
49303
  let { startZoom, startZoomPosition } = this.getState();
49304
49304
  if (!startZoomPosition) {
49305
49305
  startZoom = this.getViewportProps().zoom;
49306
- startZoomPosition = this._unproject(startPos) || this._unproject(pos);
49306
+ startZoomPosition = this._unproject(startPos || pos);
49307
49307
  }
49308
49308
  if (!startZoomPosition) {
49309
49309
  return this;
@@ -49368,9 +49368,13 @@ void main(void) {
49368
49368
  });
49369
49369
  }
49370
49370
  /* Private methods */
49371
+ _project(pos) {
49372
+ const viewport = this.makeViewport(this.getViewportProps());
49373
+ return viewport.project(pos);
49374
+ }
49371
49375
  _unproject(pos) {
49372
49376
  const viewport = this.makeViewport(this.getViewportProps());
49373
- return pos && viewport.unproject(pos);
49377
+ return viewport.unproject(pos);
49374
49378
  }
49375
49379
  // Calculates new zoom
49376
49380
  _calculateNewZoom({
@@ -49385,10 +49389,11 @@ void main(void) {
49385
49389
  return clamp(zoom, minZoom, maxZoom);
49386
49390
  }
49387
49391
  _panFromCenter(offset) {
49388
- const { width, height, target: target2 } = this.getViewportProps();
49392
+ const { target: target2 } = this.getViewportProps();
49393
+ const center2 = this._project(target2);
49389
49394
  return this.pan({
49390
49395
  startPosition: target2,
49391
- pos: [width / 2 + offset[0], height / 2 + offset[1]]
49396
+ pos: [center2[0] + offset[0], center2[1] + offset[1]]
49392
49397
  });
49393
49398
  }
49394
49399
  _getUpdatedState(newProps) {
@@ -55424,6 +55429,8 @@ void main(void) {
55424
55429
  vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + column.offset) * dotRadius;
55425
55430
  if (column.radiusUnits == UNIT_METERS) {
55426
55431
  offset = project_size(offset);
55432
+ } else if (column.radiusUnits == UNIT_PIXELS) {
55433
+ offset = project_pixel_size(offset);
55427
55434
  }
55428
55435
  vec3 pos = vec3(offset, 0.);
55429
55436
  DECKGL_FILTER_SIZE(pos, geometry);
@@ -88989,6 +88996,7 @@ void main() {
88989
88996
  init_dist7();
88990
88997
 
88991
88998
  // ../google-maps/src/utils.ts
88999
+ var POSITIONING_CONTAINER_ID = "deck-gl-google-maps-container";
88992
89000
  var MAX_LATITUDE2 = 85.05113;
88993
89001
  function createDeckInstance(map3, overlay, deck, props) {
88994
89002
  if (deck) {
@@ -89006,7 +89014,8 @@ void main() {
89006
89014
  };
89007
89015
  const newDeck = new Deck({
89008
89016
  ...props,
89009
- useDevicePixels: props.interleaved ? true : props.useDevicePixels,
89017
+ // Default to true for high-DPI displays, but allow user override
89018
+ useDevicePixels: props.useDevicePixels ?? true,
89010
89019
  style: props.interleaved ? null : { pointerEvents: "none" },
89011
89020
  parent: getContainer2(overlay, props.style),
89012
89021
  views: new MapView({ repeat: true }),
@@ -89031,10 +89040,12 @@ void main() {
89031
89040
  const container = document.createElement("div");
89032
89041
  container.style.position = "absolute";
89033
89042
  Object.assign(container.style, style);
89034
- if ("getPanes" in overlay) {
89043
+ const googleMapsContainer = overlay.getMap().getDiv();
89044
+ const positioningContainer = googleMapsContainer.querySelector(`#${POSITIONING_CONTAINER_ID}`);
89045
+ if (positioningContainer) {
89046
+ positioningContainer.appendChild(container);
89047
+ } else if ("getPanes" in overlay) {
89035
89048
  overlay.getPanes()?.overlayLayer.appendChild(container);
89036
- } else {
89037
- overlay.getMap()?.getDiv().appendChild(container);
89038
89049
  }
89039
89050
  return container;
89040
89051
  }
@@ -89213,6 +89224,7 @@ void main() {
89213
89224
  this._map = null;
89214
89225
  this._deck = null;
89215
89226
  this._overlay = null;
89227
+ this._positioningOverlay = null;
89216
89228
  this.setProps({ ...defaultProps48, ...props });
89217
89229
  }
89218
89230
  /* Public API */
@@ -89227,6 +89239,7 @@ void main() {
89227
89239
  this._overlay.requestRedraw();
89228
89240
  }
89229
89241
  this._overlay?.setMap(null);
89242
+ this._positioningOverlay?.setMap(null);
89230
89243
  this._map = null;
89231
89244
  }
89232
89245
  if (map3) {
@@ -89278,30 +89291,45 @@ void main() {
89278
89291
  }
89279
89292
  /* Private API */
89280
89293
  _createOverlay(map3) {
89281
- const { interleaved } = this.props;
89282
89294
  const { VECTOR, UNINITIALIZED } = google.maps.RenderingType;
89283
89295
  const renderingType = map3.getRenderingType();
89284
89296
  if (renderingType === UNINITIALIZED) {
89285
89297
  return;
89286
89298
  }
89287
89299
  const isVectorMap = renderingType === VECTOR && google.maps.WebGLOverlayView;
89288
- const OverlayView = isVectorMap ? google.maps.WebGLOverlayView : google.maps.OverlayView;
89289
- const overlay = new OverlayView();
89290
- if (overlay instanceof google.maps.WebGLOverlayView) {
89291
- if (interleaved) {
89292
- overlay.onAdd = noop7;
89293
- overlay.onContextRestored = this._onContextRestored.bind(this);
89294
- overlay.onDraw = this._onDrawVectorInterleaved.bind(this);
89295
- } else {
89296
- overlay.onAdd = this._onAdd.bind(this);
89297
- overlay.onContextRestored = noop7;
89298
- overlay.onDraw = this._onDrawVectorOverlay.bind(this);
89299
- }
89300
- overlay.onContextLost = this._onContextLost.bind(this);
89300
+ if (isVectorMap) {
89301
+ this._createOverlayVector(map3);
89301
89302
  } else {
89302
- overlay.onAdd = this._onAdd.bind(this);
89303
- overlay.draw = this._onDrawRaster.bind(this);
89303
+ this._createOverlayRaster(map3);
89304
89304
  }
89305
+ }
89306
+ /**
89307
+ * Create overlays for vector maps.
89308
+ * Uses OverlayView for DOM positioning (correct z-index) and
89309
+ * WebGLOverlayView for camera data (smooth animations).
89310
+ * In interleaved mode, WebGLOverlayView also provides the shared GL context.
89311
+ */
89312
+ _createOverlayVector(map3) {
89313
+ const interleaved = this.props.interleaved ?? defaultProps48.interleaved;
89314
+ const positioningOverlay = new google.maps.OverlayView();
89315
+ positioningOverlay.onAdd = this._onAddVectorOverlay.bind(this);
89316
+ positioningOverlay.draw = this._updateContainerSize.bind(this);
89317
+ positioningOverlay.onRemove = this._onRemove.bind(this);
89318
+ this._positioningOverlay = positioningOverlay;
89319
+ this._positioningOverlay.setMap(map3);
89320
+ const overlay = new google.maps.WebGLOverlayView();
89321
+ overlay.onAdd = noop7;
89322
+ overlay.onContextRestored = interleaved ? this._onContextRestored.bind(this) : noop7;
89323
+ overlay.onDraw = this._onDrawVector.bind(this);
89324
+ overlay.onContextLost = interleaved ? this._onContextLost.bind(this) : noop7;
89325
+ overlay.onRemove = interleaved ? this._onRemove.bind(this) : noop7;
89326
+ this._overlay = overlay;
89327
+ this._overlay.setMap(map3);
89328
+ }
89329
+ _createOverlayRaster(map3) {
89330
+ const overlay = new google.maps.OverlayView();
89331
+ overlay.onAdd = this._onAdd.bind(this);
89332
+ overlay.draw = this._onDrawRaster.bind(this);
89305
89333
  overlay.onRemove = this._onRemove.bind(this);
89306
89334
  this._overlay = overlay;
89307
89335
  this._overlay.setMap(map3);
@@ -89309,6 +89337,33 @@ void main() {
89309
89337
  _onAdd() {
89310
89338
  this._deck = createDeckInstance(this._map, this._overlay, this._deck, this.props);
89311
89339
  }
89340
+ _onAddVectorOverlay() {
89341
+ const overlay = this._positioningOverlay;
89342
+ const panes = overlay.getPanes();
89343
+ if (panes) {
89344
+ const container = document.createElement("div");
89345
+ container.id = POSITIONING_CONTAINER_ID;
89346
+ container.style.position = "absolute";
89347
+ panes.overlayLayer.appendChild(container);
89348
+ }
89349
+ this._deck = createDeckInstance(this._map, overlay, this._deck, this.props);
89350
+ }
89351
+ _updateContainerSize() {
89352
+ if (!this._map)
89353
+ return;
89354
+ const container = this._map.getDiv().querySelector(`#${POSITIONING_CONTAINER_ID}`);
89355
+ if (!container)
89356
+ return;
89357
+ const mapContainer = this._map.getDiv().firstChild;
89358
+ if (!mapContainer)
89359
+ return;
89360
+ const width = mapContainer.offsetWidth;
89361
+ const height = mapContainer.offsetHeight;
89362
+ container.style.width = `${width}px`;
89363
+ container.style.height = `${height}px`;
89364
+ container.style.left = `${-width / 2}px`;
89365
+ container.style.top = `${-height / 2}px`;
89366
+ }
89312
89367
  _onContextRestored({ gl }) {
89313
89368
  if (!this._map || !this._overlay) {
89314
89369
  return;
@@ -89368,19 +89423,18 @@ void main() {
89368
89423
  });
89369
89424
  deck.redraw();
89370
89425
  }
89371
- // Vector code path
89372
- _onDrawVectorInterleaved({ gl, transformer }) {
89426
+ _onDrawVector({ gl, transformer }) {
89373
89427
  if (!this._deck || !this._map) {
89374
89428
  return;
89375
89429
  }
89376
89430
  const deck = this._deck;
89431
+ const { interleaved } = this.props;
89377
89432
  deck.setProps({
89378
89433
  ...getViewPropsFromCoordinateTransformer(this._map, transformer),
89379
89434
  // Using external gl context - do not set css size
89380
- width: null,
89381
- height: null
89435
+ ...interleaved && { width: null, height: null }
89382
89436
  });
89383
- if (deck.isInitialized) {
89437
+ if (interleaved && deck.isInitialized) {
89384
89438
  const device = deck.device;
89385
89439
  if (device instanceof WebGLDevice) {
89386
89440
  const _framebuffer = device.getParametersWebGL(GLEnum.FRAMEBUFFER_BINDING);
@@ -89399,18 +89453,10 @@ void main() {
89399
89453
  });
89400
89454
  });
89401
89455
  }
89456
+ } else if (!interleaved) {
89457
+ deck.redraw();
89402
89458
  }
89403
89459
  }
89404
- _onDrawVectorOverlay({ transformer }) {
89405
- if (!this._deck || !this._map) {
89406
- return;
89407
- }
89408
- const deck = this._deck;
89409
- deck.setProps({
89410
- ...getViewPropsFromCoordinateTransformer(this._map, transformer)
89411
- });
89412
- deck.redraw();
89413
- }
89414
89460
  };
89415
89461
 
89416
89462
  // ../mapbox/src/deck-utils.ts