@deck.gl/core 9.2.0-beta.2 → 9.2.0-beta.4

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "deck.gl core library",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "version": "9.2.0-beta.2",
6
+ "version": "9.2.0-beta.4",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -42,11 +42,11 @@
42
42
  "dependencies": {
43
43
  "@loaders.gl/core": "^4.2.0",
44
44
  "@loaders.gl/images": "^4.2.0",
45
- "@luma.gl/constants": "^9.2.0",
46
- "@luma.gl/core": "^9.2.0",
47
- "@luma.gl/engine": "^9.2.0",
48
- "@luma.gl/shadertools": "^9.2.0",
49
- "@luma.gl/webgl": "^9.2.0",
45
+ "@luma.gl/constants": "^9.2.2",
46
+ "@luma.gl/core": "^9.2.2",
47
+ "@luma.gl/engine": "^9.2.2",
48
+ "@luma.gl/shadertools": "^9.2.2",
49
+ "@luma.gl/webgl": "^9.2.2",
50
50
  "@math.gl/core": "^4.1.0",
51
51
  "@math.gl/sun": "^4.1.0",
52
52
  "@math.gl/types": "^4.1.0",
@@ -58,5 +58,5 @@
58
58
  "gl-matrix": "^3.0.0",
59
59
  "mjolnir.js": "^3.0.0"
60
60
  },
61
- "gitHead": "d4804c69863b62a32dda0d1942ab209000f2ffdf"
61
+ "gitHead": "33a6d99157900066f8f4d4daa9c3bd2053cd25df"
62
62
  }
@@ -208,7 +208,7 @@ export default class AttributeManager {
208
208
  } else if (
209
209
  typeof accessorName === 'string' &&
210
210
  !buffers[accessorName] &&
211
- attribute.setConstantValue(props[accessorName])
211
+ attribute.setConstantValue(context, props[accessorName])
212
212
  ) {
213
213
  // Step 3: try set constant value from props
214
214
  // Note: if buffers[accessorName] is supplied, ignore props[accessorName]
@@ -380,7 +380,7 @@ export default class AttributeManager {
380
380
  // The attribute is flagged as constant outside of an update cycle
381
381
  // Skip allocation and updater call
382
382
  // @ts-ignore value can be set to an array by user but always cast to typed array during attribute update
383
- attribute.setConstantValue(attribute.value);
383
+ attribute.setConstantValue(opts.context, attribute.value);
384
384
  return;
385
385
  }
386
386
 
@@ -254,7 +254,7 @@ export default class Attribute extends DataColumn<AttributeOptions, AttributeInt
254
254
 
255
255
  // Use generic value
256
256
  // Returns true if successful
257
- setConstantValue(value?: NumericArray): boolean {
257
+ setConstantValue(context: any, value?: any): boolean {
258
258
  // TODO(ibgreen): WebGPU does not support constant values,
259
259
  // they will be emulated as buffers instead for now.
260
260
  const isWebGPU = this.device.type === 'webgpu';
@@ -270,7 +270,9 @@ export default class Attribute extends DataColumn<AttributeOptions, AttributeInt
270
270
  return false;
271
271
  }
272
272
 
273
- const hasChanged = this.setData({constant: true, value});
273
+ const transformedValue =
274
+ this.settings.transform && context ? this.settings.transform.call(context, value) : value;
275
+ const hasChanged = this.setData({constant: true, value: transformedValue});
274
276
 
275
277
  if (hasChanged) {
276
278
  this.setNeedsRedraw();
package/src/lib/deck.ts CHANGED
@@ -369,7 +369,7 @@ export default class Deck<ViewsT extends ViewOrViews = null> {
369
369
  if (props.gl instanceof WebGLRenderingContext) {
370
370
  log.error('WebGL1 context not supported.')();
371
371
  }
372
- deviceOrPromise = webgl2Adapter.attach(props.gl);
372
+ deviceOrPromise = webgl2Adapter.attach(props.gl, this.props.deviceProps);
373
373
  }
374
374
 
375
375
  // Create a new device
@@ -476,7 +476,7 @@ export default class Deck<ViewsT extends ViewOrViews = null> {
476
476
  this.canvas = null;
477
477
  }
478
478
 
479
- log.log(`recreating animation loop for new device! id=${props.device.id}`);
479
+ log.log(`recreating animation loop for new device! id=${props.device.id}`)();
480
480
 
481
481
  this.animationLoop = this._createAnimationLoop(props.device, props);
482
482
  this.animationLoop.start();
package/src/lib/widget.ts CHANGED
@@ -8,6 +8,7 @@ import type {PickingInfo} from './picking/pick-info';
8
8
  import type {MjolnirPointerEvent, MjolnirGestureEvent} from 'mjolnir.js';
9
9
  import type Layer from './layer';
10
10
  import type {WidgetManager, WidgetPlacement} from './widget-manager';
11
+ import type {ViewOrViews} from './view-manager';
11
12
  import {deepEqual} from '../utils/deep-equal';
12
13
  import {applyStyles, removeStyles} from '../utils/apply-styles';
13
14
 
@@ -19,7 +20,10 @@ export type WidgetProps = {
19
20
  className?: string;
20
21
  };
21
22
 
22
- export abstract class Widget<PropsT extends WidgetProps = WidgetProps> {
23
+ export abstract class Widget<
24
+ PropsT extends WidgetProps = WidgetProps,
25
+ ViewsT extends ViewOrViews = null
26
+ > {
23
27
  static defaultProps: Required<WidgetProps> = {
24
28
  id: 'widget',
25
29
  style: {},
@@ -43,7 +47,7 @@ export abstract class Widget<PropsT extends WidgetProps = WidgetProps> {
43
47
 
44
48
  // Populated by core when mounted
45
49
  widgetManager?: WidgetManager;
46
- deck?: Deck<any>;
50
+ deck?: Deck<ViewsT>;
47
51
  rootElement?: HTMLDivElement | null;
48
52
 
49
53
  constructor(props: PropsT, defaultProps: Required<PropsT>) {