deck.gl 9.2.0-beta.3 → 9.2.0

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 +45 -17
  2. package/dist.min.js +88 -86
  3. package/package.json +17 -17
package/dist/dist.dev.js CHANGED
@@ -1907,7 +1907,7 @@ or create a device with the 'debug: true' prop.`;
1907
1907
  VERSION = (
1908
1908
  // Version detection using build plugin
1909
1909
  // @ts-expect-error no-undef
1910
- true ? "9.2.0" : "running from source"
1910
+ true ? "9.2.2" : "running from source"
1911
1911
  );
1912
1912
  spector;
1913
1913
  preregisteredAdapters = /* @__PURE__ */ new Map();
@@ -9603,7 +9603,7 @@ ${source4}`;
9603
9603
  * @param gl
9604
9604
  * @returns
9605
9605
  */
9606
- async attach(gl) {
9606
+ async attach(gl, props = {}) {
9607
9607
  const { WebGLDevice: WebGLDevice2 } = await Promise.resolve().then(() => (init_webgl_device(), webgl_device_exports));
9608
9608
  if (gl instanceof WebGLDevice2) {
9609
9609
  return gl;
@@ -9614,9 +9614,11 @@ ${source4}`;
9614
9614
  if (!isWebGL(gl)) {
9615
9615
  throw new Error("Invalid WebGL2RenderingContext");
9616
9616
  }
9617
+ const createCanvasContext = props.createCanvasContext === true ? {} : props.createCanvasContext;
9617
9618
  return new WebGLDevice2({
9619
+ ...props,
9618
9620
  _handle: gl,
9619
- createCanvasContext: { canvas: gl.canvas, autoResize: false }
9621
+ createCanvasContext: { canvas: gl.canvas, autoResize: false, ...createCanvasContext }
9620
9622
  });
9621
9623
  }
9622
9624
  async create(props = {}) {
@@ -43265,7 +43267,7 @@ void main() {
43265
43267
  if (props.gl instanceof WebGLRenderingContext) {
43266
43268
  log_default.error("WebGL1 context not supported.")();
43267
43269
  }
43268
- deviceOrPromise = webgl2Adapter.attach(props.gl);
43270
+ deviceOrPromise = webgl2Adapter.attach(props.gl, this.props.deviceProps);
43269
43271
  }
43270
43272
  if (!deviceOrPromise) {
43271
43273
  deviceOrPromise = this._createDevice(props);
@@ -44531,7 +44533,7 @@ void main() {
44531
44533
  }
44532
44534
  // Use generic value
44533
44535
  // Returns true if successful
44534
- setConstantValue(value) {
44536
+ setConstantValue(context, value) {
44535
44537
  const isWebGPU = this.device.type === "webgpu";
44536
44538
  if (isWebGPU || value === void 0 || typeof value === "function") {
44537
44539
  if (isWebGPU && typeof value !== "function") {
@@ -44542,7 +44544,8 @@ void main() {
44542
44544
  }
44543
44545
  return false;
44544
44546
  }
44545
- const hasChanged = this.setData({ constant: true, value });
44547
+ const transformedValue = this.settings.transform && context ? this.settings.transform.call(context, value) : value;
44548
+ const hasChanged = this.setData({ constant: true, value: transformedValue });
44546
44549
  if (hasChanged) {
44547
44550
  this.setNeedsRedraw();
44548
44551
  }
@@ -45571,7 +45574,7 @@ void main(void) {
45571
45574
  typeof accessorName === "string" ? buffers[accessorName] : void 0,
45572
45575
  data.startIndices
45573
45576
  )) {
45574
- } else if (typeof accessorName === "string" && !buffers[accessorName] && attribute.setConstantValue(props[accessorName])) {
45577
+ } else if (typeof accessorName === "string" && !buffers[accessorName] && attribute.setConstantValue(context, props[accessorName])) {
45575
45578
  } else if (attribute.needsUpdate()) {
45576
45579
  updated = true;
45577
45580
  this._updateAttribute({
@@ -45687,7 +45690,7 @@ void main(void) {
45687
45690
  const { attribute, numInstances } = opts;
45688
45691
  debug(TRACE_ATTRIBUTE_UPDATE_START, attribute);
45689
45692
  if (attribute.constant) {
45690
- attribute.setConstantValue(attribute.value);
45693
+ attribute.setConstantValue(opts.context, attribute.value);
45691
45694
  return;
45692
45695
  }
45693
45696
  if (attribute.allocate(numInstances)) {
@@ -50017,6 +50020,7 @@ void main(void) {
50017
50020
  var uniformBlock9 = `uniform iconUniforms {
50018
50021
  float sizeScale;
50019
50022
  vec2 iconsTextureDim;
50023
+ float sizeBasis;
50020
50024
  float sizeMinPixels;
50021
50025
  float sizeMaxPixels;
50022
50026
  bool billboard;
@@ -50031,6 +50035,7 @@ void main(void) {
50031
50035
  uniformTypes: {
50032
50036
  sizeScale: "f32",
50033
50037
  iconsTextureDim: "vec2<f32>",
50038
+ sizeBasis: "f32",
50034
50039
  sizeMinPixels: "f32",
50035
50040
  sizeMaxPixels: "f32",
50036
50041
  billboard: "f32",
@@ -50084,8 +50089,9 @@ void main(void) {
50084
50089
  icon.sizeMinPixels, icon.sizeMaxPixels
50085
50090
  );
50086
50091
 
50087
- // scale icon height to match instanceSize
50088
- float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;
50092
+ // Choose correct constraint based on the 'sizeBasis' value (0.0 = width, 1.0 = height)
50093
+ float iconConstraint = icon.sizeBasis == 0.0 ? iconSize.x : iconSize.y;
50094
+ float instanceScale = iconConstraint == 0.0 ? 0.0 : sizePixels / iconConstraint;
50089
50095
 
50090
50096
  // scale and rotate vertex in "pixel" value and convert back to fraction in clipspace
50091
50097
  vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;
@@ -50099,7 +50105,6 @@ void main(void) {
50099
50105
  vec3 offset = vec3(pixelOffset, 0.0);
50100
50106
  DECKGL_FILTER_SIZE(offset, geometry);
50101
50107
  gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
50102
-
50103
50108
  } else {
50104
50109
  vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);
50105
50110
  DECKGL_FILTER_SIZE(offset_common, geometry);
@@ -50448,6 +50453,7 @@ void main(void) {
50448
50453
  sizeScale: { type: "number", value: 1, min: 0 },
50449
50454
  billboard: true,
50450
50455
  sizeUnits: "pixels",
50456
+ sizeBasis: "height",
50451
50457
  sizeMinPixels: { type: "number", min: 0, value: 0 },
50452
50458
  // min point radius in pixels
50453
50459
  sizeMaxPixels: { type: "number", min: 0, value: Number.MAX_SAFE_INTEGER },
@@ -50566,7 +50572,7 @@ void main(void) {
50566
50572
  this.state.iconManager.finalize();
50567
50573
  }
50568
50574
  draw({ uniforms }) {
50569
- const { sizeScale, sizeMinPixels, sizeMaxPixels, sizeUnits, billboard, alphaCutoff } = this.props;
50575
+ const { sizeScale, sizeBasis, sizeMinPixels, sizeMaxPixels, sizeUnits, billboard, alphaCutoff } = this.props;
50570
50576
  const { iconManager } = this.state;
50571
50577
  const iconsTexture = iconManager.getTexture();
50572
50578
  if (iconsTexture) {
@@ -50576,6 +50582,7 @@ void main(void) {
50576
50582
  iconsTextureDim: [iconsTexture.width, iconsTexture.height],
50577
50583
  sizeUnits: UNIT[sizeUnits],
50578
50584
  sizeScale,
50585
+ sizeBasis: sizeBasis === "height" ? 1 : 0,
50579
50586
  sizeMinPixels,
50580
50587
  sizeMaxPixels,
50581
50588
  billboard,
@@ -56287,12 +56294,21 @@ void main(void) {
56287
56294
  featureIds: lines.featureIds
56288
56295
  };
56289
56296
  layerProps.lines._pathType = "open";
56297
+ const vertexCount = polygons.positions.value.length / polygons.positions.size;
56298
+ const vertexValid = Array(vertexCount).fill(1);
56299
+ for (const index of polygons.primitivePolygonIndices.value) {
56300
+ vertexValid[index - 1] = 0;
56301
+ }
56290
56302
  layerProps.polygons.data = {
56291
56303
  length: polygons.polygonIndices.value.length - 1,
56292
56304
  startIndices: polygons.polygonIndices.value,
56293
56305
  attributes: {
56294
56306
  ...polygons.attributes,
56295
56307
  getPolygon: polygons.positions,
56308
+ instanceVertexValid: {
56309
+ size: 1,
56310
+ value: new Uint16Array(vertexValid)
56311
+ },
56296
56312
  pickingColors: {
56297
56313
  size: 4,
56298
56314
  value: customPickingColors.polygons
@@ -102273,16 +102289,24 @@ void main() {
102273
102289
  return;
102274
102290
  }
102275
102291
  };
102276
- const { interleaved = false, ...otherProps } = props;
102292
+ const { interleaved = false } = props;
102277
102293
  this._interleaved = interleaved;
102278
- this._props = otherProps;
102294
+ this._props = this.filterProps(props);
102295
+ }
102296
+ /** Filter out props to pass to Deck **/
102297
+ filterProps(props) {
102298
+ const { interleaved = false, useDevicePixels, ...deckProps } = props;
102299
+ if (!interleaved && useDevicePixels !== void 0) {
102300
+ deckProps.useDevicePixels = useDevicePixels;
102301
+ }
102302
+ return deckProps;
102279
102303
  }
102280
102304
  /** Update (partial) props of the underlying Deck instance. */
102281
102305
  setProps(props) {
102282
102306
  if (this._interleaved && props.layers) {
102283
102307
  resolveLayers(this._map, this._deck, this._props.layers, props.layers);
102284
102308
  }
102285
- Object.assign(this._props, props);
102309
+ Object.assign(this._props, this.filterProps(props));
102286
102310
  if (this._deck && this._map) {
102287
102311
  this._deck.setProps({
102288
102312
  ...this._props,
@@ -102342,7 +102366,11 @@ void main() {
102342
102366
  gl,
102343
102367
  deck: new Deck({
102344
102368
  ...this._props,
102345
- gl
102369
+ gl,
102370
+ parameters: { ...getDefaultParameters(map6, false), ...this._props.parameters },
102371
+ deviceProps: {
102372
+ createCanvasContext: { autoResize: true }
102373
+ }
102346
102374
  })
102347
102375
  });
102348
102376
  map6.on("styledata", this._handleStyleChange);
@@ -104904,7 +104932,7 @@ void main() {
104904
104932
  requestAnimationFrame(() => this._animate());
104905
104933
  }
104906
104934
  _getFps() {
104907
- return Math.round(this.deck.metrics.fps ?? 0);
104935
+ return Math.round(this.deck?.metrics.fps ?? 0);
104908
104936
  }
104909
104937
  };
104910
104938
  var FpsWidget = _FpsWidget;