@vitessce/scatterplot 3.1.3 → 3.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, E, S, a, b, f, e, d, c } from "./index-8a1f373a.js";
1
+ import { A, E, S, a, b, f, e, d, c } from "./index-2c270a1e.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-8a1f373a.js";
1
+ import { B as BaseDecoder } from "./index-2c270a1e.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-8a1f373a.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-2c270a1e.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-8a1f373a.js";
1
+ import { B as BaseDecoder } from "./index-2c270a1e.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-8a1f373a.js";
1
+ import { B as BaseDecoder } from "./index-2c270a1e.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-8a1f373a.js";
1
+ import { B as BaseDecoder } from "./index-2c270a1e.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-8a1f373a.js";
1
+ import { B as BaseDecoder } from "./index-2c270a1e.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1 +1 @@
1
- {"version":3,"file":"Scatterplot.d.ts","sourceRoot":"","sources":["../src/Scatterplot.js"],"names":[],"mappings":";AA6XA;;;;;;GAMG;AACH,sCAKG"}
1
+ {"version":3,"file":"Scatterplot.d.ts","sourceRoot":"","sources":["../src/Scatterplot.js"],"names":[],"mappings":";AAmYA;;;;;;GAMG;AACH,sCAKG"}
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /* eslint-disable no-param-reassign */
3
3
  import React, { forwardRef } from 'react';
4
4
  import { forceSimulation } from 'd3-force';
5
- import { deck, getSelectionLayers, ScaledExpressionExtension, SelectionExtension, } from '@vitessce/gl';
5
+ import { deck, getSelectionLayer, ScaledExpressionExtension, SelectionExtension, } from '@vitessce/gl';
6
6
  import { getDefaultColor } from '@vitessce/utils';
7
7
  import { AbstractSpatialOrScatterplot, createQuadTree, forceCollideRects, getOnHoverCallback, } from './shared-spatial-scatterplot/index.js';
8
8
  const CELLS_LAYER_ID = 'scatterplot';
@@ -182,20 +182,29 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
182
182
  }
183
183
  return result;
184
184
  }
185
- createSelectionLayers() {
185
+ createSelectionLayer() {
186
186
  const { obsEmbeddingIndex: obsIndex, obsEmbedding, viewState, setCellSelection, } = this.props;
187
187
  const { tool } = this.state;
188
188
  const { cellsQuadTree } = this;
189
189
  const flipYTooltip = true;
190
190
  const getCellCoords = makeDefaultGetObsCoords(obsEmbedding);
191
- return getSelectionLayers(tool, viewState.zoom, CELLS_LAYER_ID, getCellCoords, obsIndex, setCellSelection, cellsQuadTree, flipYTooltip);
191
+ return getSelectionLayer(tool, viewState.zoom, CELLS_LAYER_ID, [
192
+ {
193
+ getObsCoords: getCellCoords,
194
+ obsIndex,
195
+ obsQuadTree: cellsQuadTree,
196
+ onSelect: (obsIds) => {
197
+ setCellSelection(obsIds);
198
+ },
199
+ },
200
+ ], flipYTooltip);
192
201
  }
193
202
  getLayers() {
194
203
  const { cellsLayer, cellSetsLayers, } = this;
195
204
  return [
196
205
  cellsLayer,
197
206
  ...cellSetsLayers,
198
- ...this.createSelectionLayers(),
207
+ this.createSelectionLayer(),
199
208
  ];
200
209
  }
201
210
  onUpdateCellsData() {
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractSpatialOrScatterplot.d.ts","sourceRoot":"","sources":["../../src/shared-spatial-scatterplot/AbstractSpatialOrScatterplot.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH;IACE,wBAeC;IAZC;;;MAGC;IAED,wBAAoB;IAStB;;;;;;;OAOG;IACH;QAF0B,SAAS,EAAxB,MAAM;aAYhB;IAED;;;;;OAKG;IACH;QAF6B,QAAQ,EAA1B,MAAM;aAIhB;IAED;;;;;OAKG;IACH,uBAFW,MAAM,QAIhB;IAED;;;;;OAKG;IACH,mBAFW,MAAM,QAQhB;IAcD,qCAgFC;IAwCD;;MAEE;IAEF,iBAAa;IAxIb;;;;;OAKG;IAEH,aALa,MAAM,EAAE,CAOpB;IAqFD;;;;;OAKG;IACH,iFAsBC;IAED;;OAEG;IAEH,2BAEC;IAQD;;;OAGG;IAEH,SAHa,OAAO,CAKnB;IAED;;;OAGG;IACH,sBA2DC;CACF"}
1
+ {"version":3,"file":"AbstractSpatialOrScatterplot.d.ts","sourceRoot":"","sources":["../../src/shared-spatial-scatterplot/AbstractSpatialOrScatterplot.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH;IACE,wBAeC;IAZC;;;MAGC;IAED,wBAAoB;IAStB;;;;;;;OAOG;IACH;QAF0B,SAAS,EAAxB,MAAM;aAYhB;IAED;;;;;OAKG;IACH;QAF6B,QAAQ,EAA1B,MAAM;aAIhB;IAED;;;;;OAKG;IACH,uBAFW,MAAM,QAIhB;IAED;;;;;OAKG;IACH,mBAFW,MAAM,QAQhB;IAgBD,qCAgFC;IAwCD;;MAEE;IAEF,iBAAa;IA1Ib;;;;;OAKG;IAEH,aALa,MAAM,EAAE,CAOpB;IAuFD;;;;;OAKG;IACH,iFAsBC;IAED;;OAEG;IAEH,2BAEC;IAQD;;;OAGG;IAEH,SAHa,OAAO,CAKnB;IAED;;;OAGG;IACH,sBA2DC;CACF"}
@@ -33,8 +33,8 @@ export default class AbstractSpatialOrScatterplot extends PureComponent {
33
33
  * @param {object} params.viewState The next deck.gl viewState.
34
34
  */
35
35
  onViewStateChange({ viewState: nextViewState }) {
36
- const { setViewState, viewState, layers, spatialAxisFixed, } = this.props;
37
- const use3d = layers?.some(l => l.use3d);
36
+ const { setViewState, viewState, spatialAxisFixed, } = this.props;
37
+ const use3d = this.use3d();
38
38
  setViewState({
39
39
  ...nextViewState,
40
40
  // If the axis is fixed, just use the current target in state i.e don't change target.
@@ -82,6 +82,8 @@ export default class AbstractSpatialOrScatterplot extends PureComponent {
82
82
  getLayers() {
83
83
  return [];
84
84
  }
85
+ // TODO: remove this method and use the layer-level onHover instead.
86
+ // (e.g., see delegateHover in spatial-beta/SpatialSubscriber.js).
85
87
  // eslint-disable-next-line consistent-return
86
88
  onHover(info) {
87
89
  const { coordinate, sourceLayer: layer, tile, } = info;
@@ -205,7 +207,7 @@ export default class AbstractSpatialOrScatterplot extends PureComponent {
205
207
  * and Scatterplot components.
206
208
  */
207
209
  render() {
208
- const { deckRef, viewState, uuid, hideTools, } = this.props;
210
+ const { deckRef, viewState, uuid, hideTools, orbitAxis, } = this.props;
209
211
  const { gl, tool } = this.state;
210
212
  const layers = this.getLayers();
211
213
  const use3d = this.use3d();
@@ -222,7 +224,7 @@ export default class AbstractSpatialOrScatterplot extends PureComponent {
222
224
  selectLasso: showCellSelectionTools && !hideTools,
223
225
  }, recenterOnClick: this.recenter }), _jsx(deck.DeckGL, { id: `deckgl-overlay-${uuid}`, ref: deckRef, views: [
224
226
  use3d
225
- ? new deck.OrbitView({ id: 'orbit', controller: true, orbitAxis: 'Y' })
227
+ ? new deck.OrbitView({ id: 'orbit', controller: true, orbitAxis })
226
228
  : new deck.OrthographicView({
227
229
  id: 'ortho',
228
230
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/scatterplot",
3
- "version": "3.1.3",
3
+ "version": "3.2.0",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -22,12 +22,12 @@
22
22
  "d3-force": "^2.1.1",
23
23
  "d3-quadtree": "^1.0.7",
24
24
  "lodash-es": "^4.17.21",
25
- "@vitessce/constants-internal": "3.1.3",
26
- "@vitessce/gl": "3.1.3",
27
- "@vitessce/icons": "3.1.3",
28
- "@vitessce/tooltip": "3.1.3",
29
- "@vitessce/utils": "3.1.3",
30
- "@vitessce/vit-s": "3.1.3"
25
+ "@vitessce/constants-internal": "3.2.0",
26
+ "@vitessce/gl": "3.2.0",
27
+ "@vitessce/icons": "3.2.0",
28
+ "@vitessce/tooltip": "3.2.0",
29
+ "@vitessce/utils": "3.2.0",
30
+ "@vitessce/vit-s": "3.2.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@testing-library/jest-dom": "^5.16.4",
@@ -2,7 +2,7 @@
2
2
  import React, { forwardRef } from 'react';
3
3
  import { forceSimulation } from 'd3-force';
4
4
  import {
5
- deck, getSelectionLayers, ScaledExpressionExtension, SelectionExtension,
5
+ deck, getSelectionLayer, ScaledExpressionExtension, SelectionExtension,
6
6
  } from '@vitessce/gl';
7
7
  import { getDefaultColor } from '@vitessce/utils';
8
8
  import {
@@ -222,7 +222,7 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
222
222
  return result;
223
223
  }
224
224
 
225
- createSelectionLayers() {
225
+ createSelectionLayer() {
226
226
  const {
227
227
  obsEmbeddingIndex: obsIndex,
228
228
  obsEmbedding,
@@ -233,14 +233,20 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
233
233
  const { cellsQuadTree } = this;
234
234
  const flipYTooltip = true;
235
235
  const getCellCoords = makeDefaultGetObsCoords(obsEmbedding);
236
- return getSelectionLayers(
236
+ return getSelectionLayer(
237
237
  tool,
238
238
  viewState.zoom,
239
239
  CELLS_LAYER_ID,
240
- getCellCoords,
241
- obsIndex,
242
- setCellSelection,
243
- cellsQuadTree,
240
+ [
241
+ {
242
+ getObsCoords: getCellCoords,
243
+ obsIndex,
244
+ obsQuadTree: cellsQuadTree,
245
+ onSelect: (obsIds) => {
246
+ setCellSelection(obsIds);
247
+ },
248
+ },
249
+ ],
244
250
  flipYTooltip,
245
251
  );
246
252
  }
@@ -253,7 +259,7 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
253
259
  return [
254
260
  cellsLayer,
255
261
  ...cellSetsLayers,
256
- ...this.createSelectionLayers(),
262
+ this.createSelectionLayer(),
257
263
  ];
258
264
  }
259
265
 
@@ -37,9 +37,9 @@ export default class AbstractSpatialOrScatterplot extends PureComponent {
37
37
  */
38
38
  onViewStateChange({ viewState: nextViewState }) {
39
39
  const {
40
- setViewState, viewState, layers, spatialAxisFixed,
40
+ setViewState, viewState, spatialAxisFixed,
41
41
  } = this.props;
42
- const use3d = layers?.some(l => l.use3d);
42
+ const use3d = this.use3d();
43
43
  setViewState({
44
44
  ...nextViewState,
45
45
  // If the axis is fixed, just use the current target in state i.e don't change target.
@@ -92,6 +92,8 @@ export default class AbstractSpatialOrScatterplot extends PureComponent {
92
92
  return [];
93
93
  }
94
94
 
95
+ // TODO: remove this method and use the layer-level onHover instead.
96
+ // (e.g., see delegateHover in spatial-beta/SpatialSubscriber.js).
95
97
  // eslint-disable-next-line consistent-return
96
98
  onHover(info) {
97
99
  const {
@@ -234,7 +236,7 @@ export default class AbstractSpatialOrScatterplot extends PureComponent {
234
236
  */
235
237
  render() {
236
238
  const {
237
- deckRef, viewState, uuid, hideTools,
239
+ deckRef, viewState, uuid, hideTools, orbitAxis,
238
240
  } = this.props;
239
241
  const { gl, tool } = this.state;
240
242
  const layers = this.getLayers();
@@ -268,7 +270,7 @@ export default class AbstractSpatialOrScatterplot extends PureComponent {
268
270
  ref={deckRef}
269
271
  views={[
270
272
  use3d
271
- ? new deck.OrbitView({ id: 'orbit', controller: true, orbitAxis: 'Y' })
273
+ ? new deck.OrbitView({ id: 'orbit', controller: true, orbitAxis })
272
274
  : new deck.OrthographicView({
273
275
  id: 'ortho',
274
276
  }),