@vitessce/gl 2.0.3 → 3.0.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 (97) hide show
  1. package/dist/{deflate.04b04545.mjs → deflate-36830437.js} +2 -2
  2. package/dist/{index.9aaafdeb.mjs → index-d34ff949.js} +13285 -10710
  3. package/dist/index.js +33 -0
  4. package/dist/{jpeg.060c9bc0.mjs → jpeg-a66190dc.js} +1 -1
  5. package/dist/{lerc.62b02b29.mjs → lerc-21af7ec8.js} +76 -5
  6. package/dist/{lzw.19cdd4de.mjs → lzw-76194936.js} +1 -1
  7. package/dist/{packbits.03fc75de.mjs → packbits-bf7850c4.js} +1 -1
  8. package/dist/{pako.esm.0e57f323.mjs → pako.esm-68f84e2a.js} +97 -15
  9. package/dist/{raw.739ce163.mjs → raw-05d82ade.js} +1 -1
  10. package/dist/{webimage.4e868fb9.mjs → webimage-1ceac06a.js} +1 -1
  11. package/dist-tsc/BitmaskLayer.d.ts +74 -0
  12. package/dist-tsc/BitmaskLayer.d.ts.map +1 -0
  13. package/dist-tsc/BitmaskLayer.js +142 -0
  14. package/dist-tsc/HeatmapBitmapLayer.d.ts +93 -0
  15. package/dist-tsc/HeatmapBitmapLayer.d.ts.map +1 -0
  16. package/dist-tsc/HeatmapBitmapLayer.js +123 -0
  17. package/dist-tsc/HeatmapCompositeTextLayer.d.ts +11 -0
  18. package/dist-tsc/HeatmapCompositeTextLayer.d.ts.map +1 -0
  19. package/dist-tsc/HeatmapCompositeTextLayer.js +129 -0
  20. package/dist-tsc/PaddedExpressionHeatmapBitmapLayer.d.ts +93 -0
  21. package/dist-tsc/PaddedExpressionHeatmapBitmapLayer.d.ts.map +1 -0
  22. package/dist-tsc/PaddedExpressionHeatmapBitmapLayer.js +129 -0
  23. package/dist-tsc/PixelatedBitmapLayer.d.ts +10 -0
  24. package/dist-tsc/PixelatedBitmapLayer.d.ts.map +1 -0
  25. package/dist-tsc/PixelatedBitmapLayer.js +26 -0
  26. package/dist-tsc/ScaledExpressionExtension/ScaledExpressionExtension.d.ts +62 -0
  27. package/dist-tsc/ScaledExpressionExtension/ScaledExpressionExtension.d.ts.map +1 -0
  28. package/dist-tsc/ScaledExpressionExtension/ScaledExpressionExtension.js +105 -0
  29. package/dist-tsc/ScaledExpressionExtension/index.d.ts +3 -0
  30. package/dist-tsc/ScaledExpressionExtension/index.d.ts.map +1 -0
  31. package/dist-tsc/ScaledExpressionExtension/index.js +2 -0
  32. package/dist-tsc/ScaledExpressionExtension/shader-module.d.ts +17 -0
  33. package/dist-tsc/ScaledExpressionExtension/shader-module.d.ts.map +1 -0
  34. package/dist-tsc/ScaledExpressionExtension/shader-module.js +32 -0
  35. package/dist-tsc/SelectionExtension/SelectionExtension.d.ts +18 -0
  36. package/dist-tsc/SelectionExtension/SelectionExtension.d.ts.map +1 -0
  37. package/dist-tsc/SelectionExtension/SelectionExtension.js +31 -0
  38. package/dist-tsc/SelectionExtension/index.d.ts +3 -0
  39. package/dist-tsc/SelectionExtension/index.d.ts.map +1 -0
  40. package/dist-tsc/SelectionExtension/index.js +2 -0
  41. package/dist-tsc/SelectionExtension/shader-module.d.ts +12 -0
  42. package/dist-tsc/SelectionExtension/shader-module.d.ts.map +1 -0
  43. package/dist-tsc/SelectionExtension/shader-module.js +20 -0
  44. package/dist-tsc/SelectionLayer.d.ts +15 -0
  45. package/dist-tsc/SelectionLayer.d.ts.map +1 -0
  46. package/dist-tsc/SelectionLayer.js +157 -0
  47. package/dist-tsc/bitmask-layer-shaders.d.ts +3 -0
  48. package/dist-tsc/bitmask-layer-shaders.d.ts.map +1 -0
  49. package/dist-tsc/bitmask-layer-shaders.js +90 -0
  50. package/dist-tsc/constants.d.ts +8 -0
  51. package/dist-tsc/constants.d.ts.map +1 -0
  52. package/dist-tsc/constants.js +11 -0
  53. package/dist-tsc/deck.d.ts +2 -0
  54. package/dist-tsc/deck.d.ts.map +1 -0
  55. package/dist-tsc/deck.js +4 -0
  56. package/dist-tsc/glsl/index.d.ts +2 -0
  57. package/dist-tsc/glsl/index.d.ts.map +1 -0
  58. package/dist-tsc/glsl/index.js +340 -0
  59. package/dist-tsc/heatmap-bitmap-layer-shaders.d.ts +13 -0
  60. package/dist-tsc/heatmap-bitmap-layer-shaders.d.ts.map +1 -0
  61. package/dist-tsc/heatmap-bitmap-layer-shaders.js +109 -0
  62. package/dist-tsc/heatmap-constants.d.ts +20 -0
  63. package/dist-tsc/heatmap-constants.d.ts.map +1 -0
  64. package/dist-tsc/heatmap-constants.js +27 -0
  65. package/dist-tsc/index.d.ts +14 -0
  66. package/dist-tsc/index.d.ts.map +1 -0
  67. package/dist-tsc/index.js +16 -13
  68. package/dist-tsc/luma.d.ts +2 -0
  69. package/dist-tsc/luma.d.ts.map +1 -0
  70. package/dist-tsc/luma.js +2 -0
  71. package/dist-tsc/padded-expression-heatmap-bitmap-layer-shaders.d.ts +13 -0
  72. package/dist-tsc/padded-expression-heatmap-bitmap-layer-shaders.d.ts.map +1 -0
  73. package/dist-tsc/padded-expression-heatmap-bitmap-layer-shaders.js +143 -0
  74. package/dist-tsc/selection-utils.d.ts +19 -0
  75. package/dist-tsc/selection-utils.d.ts.map +1 -0
  76. package/dist-tsc/selection-utils.js +92 -0
  77. package/dist-tsc/viv.d.ts +2 -0
  78. package/dist-tsc/viv.d.ts.map +1 -0
  79. package/dist-tsc/viv.js +3 -0
  80. package/package.json +15 -6
  81. package/src/BitmaskLayer.js +14 -4
  82. package/src/HeatmapBitmapLayer.js +3 -3
  83. package/src/HeatmapCompositeTextLayer.js +1 -1
  84. package/src/PaddedExpressionHeatmapBitmapLayer.js +3 -3
  85. package/src/PixelatedBitmapLayer.js +1 -1
  86. package/src/ScaledExpressionExtension/ScaledExpressionExtension.js +2 -2
  87. package/src/ScaledExpressionExtension/index.js +1 -1
  88. package/src/ScaledExpressionExtension/shader-module.js +1 -1
  89. package/src/SelectionExtension/SelectionExtension.js +1 -1
  90. package/src/SelectionExtension/index.js +1 -1
  91. package/src/SelectionLayer.js +1 -12
  92. package/src/bitmask-layer-shaders.js +1 -1
  93. package/src/heatmap-bitmap-layer-shaders.js +1 -1
  94. package/src/index.js +16 -13
  95. package/src/padded-expression-heatmap-bitmap-layer-shaders.js +1 -1
  96. package/src/selection-utils.js +1 -1
  97. package/dist/index.mjs +0 -33
@@ -0,0 +1,129 @@
1
+ /* eslint-disable no-underscore-dangle */
2
+ import GL from '@luma.gl/constants'; // eslint-disable-line import/no-extraneous-dependencies
3
+ import { _mergeShaders, project32, picking } from '@deck.gl/core'; // eslint-disable-line import/no-extraneous-dependencies
4
+ import { BitmapLayer } from '@deck.gl/layers'; // eslint-disable-line import/no-extraneous-dependencies
5
+ import { Texture2D } from '@luma.gl/core';
6
+ import { PIXELATED_TEXTURE_PARAMETERS, TILE_SIZE, DATA_TEXTURE_SIZE } from './heatmap-constants.js';
7
+ import { GLSL_COLORMAPS, GLSL_COLORMAP_DEFAULT, COLORMAP_SHADER_PLACEHOLDER } from './constants.js';
8
+ import { vertexShader, fragmentShader } from './padded-expression-heatmap-bitmap-layer-shaders.js';
9
+ const defaultProps = {
10
+ image: { type: 'object', value: null, async: true },
11
+ colormap: { type: 'string', value: GLSL_COLORMAP_DEFAULT, compare: true },
12
+ bounds: { type: 'array', value: [1, 0, 0, 1], compare: true },
13
+ aggSizeX: { type: 'number', value: 8.0, compare: true },
14
+ aggSizeY: { type: 'number', value: 8.0, compare: true },
15
+ colorScaleLo: { type: 'number', value: 0.0, compare: true },
16
+ colorScaleHi: { type: 'number', value: 1.0, compare: true },
17
+ };
18
+ /**
19
+ * A BitmapLayer that performs aggregation in the fragment shader,
20
+ * and renders its texture from a Uint8Array rather than an ImageData.
21
+ */
22
+ export default class PaddedExpressionHeatmapBitmapLayer extends BitmapLayer {
23
+ /**
24
+ * Copy of getShaders from Layer (grandparent, parent of BitmapLayer).
25
+ * Reference: https://github.com/visgl/deck.gl/blob/0afd4e99a6199aeec979989e0c361c97e6c17a16/modules/core/src/lib/layer.js#L302
26
+ * @param {object} shaders
27
+ * @returns {object} Merged shaders.
28
+ */
29
+ _getShaders(shaders) {
30
+ this.props.extensions.forEach((extension) => {
31
+ // eslint-disable-next-line no-param-reassign
32
+ shaders = _mergeShaders(shaders, extension.getShaders.call(this, extension));
33
+ });
34
+ return shaders;
35
+ }
36
+ /**
37
+ * Need to override to provide custom shaders.
38
+ */
39
+ getShaders() {
40
+ const { colormap } = this.props;
41
+ const fragmentShaderWithColormap = GLSL_COLORMAPS.includes(colormap)
42
+ ? fragmentShader.replace(COLORMAP_SHADER_PLACEHOLDER, colormap)
43
+ : fragmentShader.replace(COLORMAP_SHADER_PLACEHOLDER, GLSL_COLORMAP_DEFAULT);
44
+ return this._getShaders({
45
+ vs: vertexShader,
46
+ fs: fragmentShaderWithColormap,
47
+ modules: [project32, picking],
48
+ });
49
+ }
50
+ updateState(args) {
51
+ super.updateState(args);
52
+ const { props, oldProps } = args;
53
+ if (props.colormap !== oldProps.colormap) {
54
+ const { gl } = this.context;
55
+ // eslint-disable-next-line no-unused-expressions
56
+ this.state.model?.delete();
57
+ this.state.model = this._getModel(gl);
58
+ this.getAttributeManager().invalidateAll();
59
+ }
60
+ if (props.image !== oldProps.image) {
61
+ this.loadTexture(this.props.image);
62
+ }
63
+ }
64
+ /**
65
+ * Need to override to provide additional uniform values.
66
+ * Simplified by removing video-related code.
67
+ * Reference: https://github.com/visgl/deck.gl/blob/0afd4e99a6199aeec979989e0c361c97e6c17a16/modules/layers/src/bitmap-layer/bitmap-layer.js#L173
68
+ * @param {*} opts
69
+ */
70
+ draw(opts) {
71
+ const { uniforms } = opts;
72
+ const { bitmapTexture, model } = this.state;
73
+ const { aggSizeX, aggSizeY, colorScaleLo, colorScaleHi, origDataSize, tileI, tileJ, numXTiles, numYTiles, } = this.props;
74
+ // Render the image
75
+ if (bitmapTexture && model) {
76
+ model
77
+ .setUniforms(Object.assign({}, uniforms, {
78
+ uBitmapTexture: bitmapTexture,
79
+ uOrigDataSize: origDataSize,
80
+ uReshapedDataSize: [DATA_TEXTURE_SIZE, DATA_TEXTURE_SIZE],
81
+ uTextureSize: [TILE_SIZE, TILE_SIZE],
82
+ uAggSize: [aggSizeX, aggSizeY],
83
+ uColorScaleRange: [colorScaleLo, colorScaleHi],
84
+ tileIJ: [tileI, tileJ],
85
+ dataIJ: [0, 0],
86
+ numTiles: [numXTiles, numYTiles],
87
+ numData: [1, 1],
88
+ }))
89
+ .draw();
90
+ }
91
+ }
92
+ /**
93
+ * Need to override to provide the custom DEFAULT_TEXTURE_PARAMETERS
94
+ * object.
95
+ * Simplified by removing video-related code.
96
+ * Reference: https://github.com/visgl/deck.gl/blob/0afd4e99a6199aeec979989e0c361c97e6c17a16/modules/layers/src/bitmap-layer/bitmap-layer.js#L218
97
+ * @param {Array<Uint8Array>} images
98
+ */
99
+ loadTexture(image) {
100
+ const { gl } = this.context;
101
+ if (this.state.bitmapTexture) {
102
+ this.state.bitmapTexture.delete();
103
+ }
104
+ if (image && image instanceof Texture2D) {
105
+ this.setState({
106
+ bitmapTexture: image,
107
+ });
108
+ }
109
+ else if (image) {
110
+ this.setState({
111
+ bitmapTexture: new Texture2D(gl, {
112
+ data: image,
113
+ mipmaps: false,
114
+ parameters: PIXELATED_TEXTURE_PARAMETERS,
115
+ // Each color contains a single luminance value.
116
+ // When sampled, rgb are all set to this luminance, alpha is 1.0.
117
+ // Reference: https://luma.gl/docs/api-reference/webgl/texture#texture-formats
118
+ format: GL.LUMINANCE,
119
+ dataFormat: GL.LUMINANCE,
120
+ type: GL.UNSIGNED_BYTE,
121
+ width: DATA_TEXTURE_SIZE,
122
+ height: DATA_TEXTURE_SIZE,
123
+ }),
124
+ });
125
+ }
126
+ }
127
+ }
128
+ PaddedExpressionHeatmapBitmapLayer.layerName = 'PaddedExpressionHeatmapBitmapLayer';
129
+ PaddedExpressionHeatmapBitmapLayer.defaultProps = defaultProps;
@@ -0,0 +1,10 @@
1
+ declare class PixelatedBitmapLayer {
2
+ renderLayers(): any;
3
+ }
4
+ declare namespace PixelatedBitmapLayer {
5
+ export const layerName: string;
6
+ export { defaultProps };
7
+ }
8
+ export default PixelatedBitmapLayer;
9
+ declare const defaultProps: any;
10
+ //# sourceMappingURL=PixelatedBitmapLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PixelatedBitmapLayer.d.ts","sourceRoot":"","sources":["../src/PixelatedBitmapLayer.js"],"names":[],"mappings":"AAiBA;IACE,oBAOC;CACF;;;;;;AApBD,gCASE"}
@@ -0,0 +1,26 @@
1
+ import { BitmapLayer } from '@deck.gl/layers'; // eslint-disable-line import/no-extraneous-dependencies
2
+ import { CompositeLayer } from '@deck.gl/core'; // eslint-disable-line import/no-extraneous-dependencies
3
+ import { PIXELATED_TEXTURE_PARAMETERS } from './heatmap-constants.js';
4
+ // These are the same defaultProps as for BitmapLayer.
5
+ const defaultProps = {
6
+ ...BitmapLayer.defaultProps,
7
+ image: { type: 'object', value: null, async: true },
8
+ bounds: { type: 'array', value: [1, 0, 0, 1], compare: true },
9
+ desaturate: {
10
+ type: 'number', min: 0, max: 1, value: 0,
11
+ },
12
+ transparentColor: { type: 'color', value: [0, 0, 0, 0] },
13
+ tintColor: { type: 'color', value: [255, 255, 255] },
14
+ };
15
+ export default class PixelatedBitmapLayer extends CompositeLayer {
16
+ renderLayers() {
17
+ const { image } = this.props;
18
+ return new BitmapLayer(this.props, {
19
+ id: `${this.props.id}-wrapped`,
20
+ image,
21
+ textureParameters: PIXELATED_TEXTURE_PARAMETERS,
22
+ });
23
+ }
24
+ }
25
+ PixelatedBitmapLayer.layerName = 'PixelatedBitmapLayer';
26
+ PixelatedBitmapLayer.defaultProps = defaultProps;
@@ -0,0 +1,62 @@
1
+ declare class ScaledExpressionExtension {
2
+ getShaders(): {
3
+ modules: {
4
+ name: string;
5
+ vs: string;
6
+ inject: {
7
+ 'vs:DECKGL_FILTER_COLOR': string;
8
+ };
9
+ }[];
10
+ defines: {
11
+ COLORMAP_FUNC: any;
12
+ };
13
+ };
14
+ updateState({ props, oldProps }: {
15
+ props: any;
16
+ oldProps: any;
17
+ }): void;
18
+ initializeState(): void;
19
+ draw(): void;
20
+ }
21
+ declare namespace ScaledExpressionExtension {
22
+ export const extensionName: string;
23
+ export { defaultProps };
24
+ }
25
+ export default ScaledExpressionExtension;
26
+ declare namespace defaultProps {
27
+ namespace colormap {
28
+ export const type: string;
29
+ export { GLSL_COLORMAP_DEFAULT as value };
30
+ export const compare: boolean;
31
+ }
32
+ namespace colorScaleLo {
33
+ const type_1: string;
34
+ export { type_1 as type };
35
+ export const value: number;
36
+ const compare_1: boolean;
37
+ export { compare_1 as compare };
38
+ }
39
+ namespace colorScaleHi {
40
+ const type_2: string;
41
+ export { type_2 as type };
42
+ const value_1: number;
43
+ export { value_1 as value };
44
+ const compare_2: boolean;
45
+ export { compare_2 as compare };
46
+ }
47
+ const isExpressionMode: boolean;
48
+ namespace getExpressionValue {
49
+ const type_3: string;
50
+ export { type_3 as type };
51
+ const value_2: number;
52
+ export { value_2 as value };
53
+ }
54
+ namespace getSelectionState {
55
+ const type_4: string;
56
+ export { type_4 as type };
57
+ const value_3: number;
58
+ export { value_3 as value };
59
+ }
60
+ }
61
+ import { GLSL_COLORMAP_DEFAULT } from "../constants.js";
62
+ //# sourceMappingURL=ScaledExpressionExtension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScaledExpressionExtension.d.ts","sourceRoot":"","sources":["../../src/ScaledExpressionExtension/ScaledExpressionExtension.js"],"names":[],"mappings":"AAgBA;IACE;;;;;;;;;;;MAUC;IAED;;;aA+BC;IAED,wBAwBC;IAED,aAwBC;CACF"}
@@ -0,0 +1,105 @@
1
+ /* eslint-disable no-underscore-dangle */
2
+ /* eslint-disable import/no-extraneous-dependencies */
3
+ import GL from '@luma.gl/constants';
4
+ import { LayerExtension } from '@deck.gl/core';
5
+ import { GLSL_COLORMAPS, GLSL_COLORMAP_DEFAULT, COLORMAP_SHADER_PLACEHOLDER } from '../constants.js';
6
+ import module from './shader-module.js';
7
+ const defaultProps = {
8
+ colormap: { type: 'string', value: GLSL_COLORMAP_DEFAULT, compare: true },
9
+ colorScaleLo: { type: 'number', value: 0.0, compare: true },
10
+ colorScaleHi: { type: 'number', value: 1.0, compare: true },
11
+ isExpressionMode: false,
12
+ getExpressionValue: { type: 'accessor', value: 0 },
13
+ getSelectionState: { type: 'accessor', value: 0.0 },
14
+ };
15
+ export default class ScaledExpressionExtension extends LayerExtension {
16
+ getShaders() {
17
+ const { colormap } = this.props;
18
+ return {
19
+ modules: [module],
20
+ defines: {
21
+ [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap)
22
+ ? colormap
23
+ : GLSL_COLORMAP_DEFAULT,
24
+ },
25
+ };
26
+ }
27
+ updateState({ props, oldProps }) {
28
+ if (props.colormap !== oldProps.colormap) {
29
+ const { gl } = this.context;
30
+ // Normal single model layers, like ScatterplotLayer
31
+ if (this.state.model) {
32
+ // eslint-disable-next-line no-unused-expressions
33
+ this.state.model?.delete();
34
+ this.state.model = this._getModel(gl);
35
+ }
36
+ else {
37
+ // Special handling for PolygonLayer sublayer models.
38
+ if (this.state.models) {
39
+ // eslint-disable-next-line no-unused-expressions
40
+ this.state.models?.forEach(model => model?.delete());
41
+ }
42
+ if (this.state.topModel) {
43
+ // eslint-disable-next-line no-unused-expressions
44
+ this.state.topModel?.delete();
45
+ }
46
+ if (this.state.sideModel) {
47
+ // eslint-disable-next-line no-unused-expressions
48
+ this.state.sideModel?.delete();
49
+ }
50
+ if (this._getModels) {
51
+ this.setState(this._getModels(this.context.gl));
52
+ }
53
+ }
54
+ const attributeManager = this.getAttributeManager();
55
+ if (attributeManager) {
56
+ this.getAttributeManager().invalidateAll();
57
+ }
58
+ }
59
+ }
60
+ initializeState() {
61
+ const layer = this.getCurrentLayer();
62
+ // No need to run this on layers that don't have a `draw` call.
63
+ if (layer.isComposite) {
64
+ return;
65
+ }
66
+ const attributeManager = this.getAttributeManager();
67
+ if (attributeManager) {
68
+ // This attributes is the array of expression data needed for
69
+ // coloring cells against the colormap.
70
+ attributeManager.add({
71
+ expressionValue: {
72
+ type: GL.FLOAT,
73
+ size: 1,
74
+ transition: true,
75
+ accessor: 'getExpressionValue',
76
+ defaultValue: 1,
77
+ // PolygonLayer fill needs not-intsanced attribute but
78
+ // ScatterplotLayer and the PolygonLayer stroke needs instanced.
79
+ // So use another attribute's divisor property as a proxy for this divisor.
80
+ divisor: Object.values(attributeManager.attributes)[0].settings.divisor,
81
+ },
82
+ });
83
+ }
84
+ }
85
+ draw() {
86
+ const { colorScaleLo, colorScaleHi, isExpressionMode, } = this.props;
87
+ const { topModel, sideModel, models, model, } = this.state;
88
+ const uniforms = {
89
+ uColorScaleRange: [colorScaleLo, colorScaleHi],
90
+ uIsExpressionMode: isExpressionMode,
91
+ };
92
+ // ScatterplotLayer model
93
+ // eslint-disable-next-line no-unused-expressions
94
+ model?.setUniforms(uniforms);
95
+ // PolygonLayer models from sublayers
96
+ // eslint-disable-next-line no-unused-expressions
97
+ models?.forEach(m => m.setUniforms(uniforms));
98
+ // eslint-disable-next-line no-unused-expressions
99
+ topModel?.setUniforms(uniforms);
100
+ // eslint-disable-next-line no-unused-expressions
101
+ sideModel?.setUniforms(uniforms);
102
+ }
103
+ }
104
+ ScaledExpressionExtension.extensionName = 'ScaledExpressionExtension';
105
+ ScaledExpressionExtension.defaultProps = defaultProps;
@@ -0,0 +1,3 @@
1
+ export default ScaledExpressionExtension;
2
+ import ScaledExpressionExtension from "./ScaledExpressionExtension.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ScaledExpressionExtension/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import ScaledExpressionExtension from './ScaledExpressionExtension.js';
2
+ export default ScaledExpressionExtension;
@@ -0,0 +1,17 @@
1
+ declare namespace _default {
2
+ export const name: string;
3
+ export { vs };
4
+ export { inject };
5
+ }
6
+ export default _default;
7
+ /**
8
+ *
9
+ * Reference: https://github.com/visgl/deck.gl/blob/8.4-release/modules/layers/src/scatterplot-layer/scatterplot-layer-vertex.glsl.js
10
+ * Reference: https://observablehq.com/@rreusser/selecting-the-right-opacity-for-2d-point-clouds
11
+ * Reference: https://github.com/flekschas/regl-scatterplot/blob/5e3b03e/src/point.vs
12
+ */
13
+ declare const vs: string;
14
+ declare const inject: {
15
+ 'vs:DECKGL_FILTER_COLOR': string;
16
+ };
17
+ //# sourceMappingURL=shader-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/ScaledExpressionExtension/shader-module.js"],"names":[],"mappings":";;;;;;AAEA;;;;;GAKG;AACH,yBAUE;AAEF;;EAQE"}
@@ -0,0 +1,32 @@
1
+ import { colormaps } from '../glsl/index.js';
2
+ /**
3
+ *
4
+ * Reference: https://github.com/visgl/deck.gl/blob/8.4-release/modules/layers/src/scatterplot-layer/scatterplot-layer-vertex.glsl.js
5
+ * Reference: https://observablehq.com/@rreusser/selecting-the-right-opacity-for-2d-point-clouds
6
+ * Reference: https://github.com/flekschas/regl-scatterplot/blob/5e3b03e/src/point.vs
7
+ */
8
+ const vs = `
9
+ ${colormaps}
10
+
11
+ // Custom attributes for Vitessce:
12
+ attribute float expressionValue;
13
+
14
+ // Custom uniforms for Vitessce:
15
+ uniform vec2 uColorScaleRange;
16
+ uniform bool uIsExpressionMode;
17
+
18
+ `;
19
+ const inject = {
20
+ 'vs:DECKGL_FILTER_COLOR': `
21
+ if(uIsExpressionMode) {
22
+ float normalizedExpressionValue = expressionValue / 255.0;
23
+ float scaledExpressionValue = (normalizedExpressionValue - uColorScaleRange[0]) / max(0.005, (uColorScaleRange[1] - uColorScaleRange[0]));
24
+ color.rgb = COLORMAP_FUNC(clamp(scaledExpressionValue, 0.0, 1.0)).rgb;
25
+ }
26
+ `,
27
+ };
28
+ export default {
29
+ name: 'scaled-expression',
30
+ vs,
31
+ inject,
32
+ };
@@ -0,0 +1,18 @@
1
+ declare class SelectionExtension {
2
+ getShaders(): {
3
+ modules: {
4
+ name: string;
5
+ vs: string;
6
+ inject: {
7
+ 'vs:DECKGL_FILTER_GL_POSITION': string;
8
+ 'fs:#main-start': string;
9
+ };
10
+ }[];
11
+ };
12
+ initializeState(context: any, extension: any): void;
13
+ }
14
+ declare namespace SelectionExtension {
15
+ const extensionName: string;
16
+ }
17
+ export default SelectionExtension;
18
+ //# sourceMappingURL=SelectionExtension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionExtension.d.ts","sourceRoot":"","sources":["../../src/SelectionExtension/SelectionExtension.js"],"names":[],"mappings":"AAMA;IAEE;;;;;;;;;MAIC;IAED,oDAgBC;CACF"}
@@ -0,0 +1,31 @@
1
+ /* eslint-disable no-underscore-dangle */
2
+ /* eslint-disable import/no-extraneous-dependencies */
3
+ import GL from '@luma.gl/constants';
4
+ import { LayerExtension } from '@deck.gl/core';
5
+ import module from './shader-module.js';
6
+ export default class SelectionExtension extends LayerExtension {
7
+ // eslint-disable-next-line class-methods-use-this
8
+ getShaders() {
9
+ return {
10
+ modules: [module],
11
+ };
12
+ }
13
+ initializeState(context, extension) {
14
+ const attributeManager = this.getAttributeManager();
15
+ if (attributeManager) {
16
+ attributeManager.add({
17
+ isSelected: {
18
+ type: GL.FLOAT,
19
+ size: 1,
20
+ transition: true,
21
+ accessor: 'getCellIsSelected',
22
+ defaultValue: 1,
23
+ // PolygonLayer needs not-intsanced attribute but
24
+ // ScatterplotLayer needs instanced.
25
+ divisor: Number(extension.opts.instanced),
26
+ },
27
+ });
28
+ }
29
+ }
30
+ }
31
+ SelectionExtension.extensionName = 'SelectionExtension';
@@ -0,0 +1,3 @@
1
+ export default SelectionExtension;
2
+ import SelectionExtension from "./SelectionExtension.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SelectionExtension/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import SelectionExtension from './SelectionExtension.js';
2
+ export default SelectionExtension;
@@ -0,0 +1,12 @@
1
+ declare namespace _default {
2
+ export const name: string;
3
+ export { vs };
4
+ export { inject };
5
+ }
6
+ export default _default;
7
+ declare const vs: "\nattribute float isSelected;\n";
8
+ declare const inject: {
9
+ 'vs:DECKGL_FILTER_GL_POSITION': string;
10
+ 'fs:#main-start': string;
11
+ };
12
+ //# sourceMappingURL=shader-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/SelectionExtension/shader-module.js"],"names":[],"mappings":";;;;;;AAAA,oDAEE;AAEF;;;EAWE"}
@@ -0,0 +1,20 @@
1
+ const vs = `
2
+ attribute float isSelected;
3
+ `;
4
+ const inject = {
5
+ 'vs:DECKGL_FILTER_GL_POSITION': `
6
+ position.z += (1. - isSelected) * .00005; // Add a small z offset for unselected points in the positive direction i.e into the screen.
7
+ `,
8
+ 'fs:#main-start': ` // Gets rid of bad border effects (active after deck.gl 8.5): https://github.com/visgl/deck.gl/pull/6081
9
+ float distToCenterNew = length(unitPosition) * outerRadiusPixels;
10
+ float inCircleNew = step(distToCenterNew, outerRadiusPixels);
11
+ if (inCircleNew == 0.0) {
12
+ discard;
13
+ }
14
+ `,
15
+ };
16
+ export default {
17
+ name: 'selection',
18
+ vs,
19
+ inject,
20
+ };
@@ -0,0 +1,15 @@
1
+ declare class SelectionLayer {
2
+ _selectPolygonObjects(coordinates: any): void;
3
+ renderLayers(): EditableGeoJsonLayer[];
4
+ }
5
+ declare namespace SelectionLayer {
6
+ export const layerName: string;
7
+ export { defaultProps };
8
+ }
9
+ export default SelectionLayer;
10
+ import { EditableGeoJsonLayer } from "@nebula.gl/layers";
11
+ declare namespace defaultProps {
12
+ const layerIds: never[];
13
+ function onSelect(): void;
14
+ }
15
+ //# sourceMappingURL=SelectionLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionLayer.d.ts","sourceRoot":"","sources":["../src/SelectionLayer.js"],"names":[],"mappings":"AAqEA;IACE,8CA0DC;IAED,uCAoDC;CACF;;;;;;;;;IAxJW,0BAAQ"}