@genome-spy/core 0.48.0 → 0.48.2

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 (46) hide show
  1. package/dist/bundle/index.es.js +3613 -3504
  2. package/dist/bundle/index.js +85 -85
  3. package/dist/schema.json +9 -2
  4. package/dist/src/data/collector.d.ts +10 -8
  5. package/dist/src/data/collector.d.ts.map +1 -1
  6. package/dist/src/data/collector.js +131 -33
  7. package/dist/src/data/collector.test.js +55 -1
  8. package/dist/src/data/transforms/identifier.d.ts +1 -1
  9. package/dist/src/data/transforms/identifier.d.ts.map +1 -1
  10. package/dist/src/data/transforms/identifier.js +2 -2
  11. package/dist/src/data/transforms/identifier.test.js +23 -14
  12. package/dist/src/genomeSpy.d.ts.map +1 -1
  13. package/dist/src/genomeSpy.js +14 -15
  14. package/dist/src/gl/dataToVertices.d.ts +1 -1
  15. package/dist/src/gl/dataToVertices.d.ts.map +1 -1
  16. package/dist/src/gl/dataToVertices.js +8 -5
  17. package/dist/src/gl/glslScaleGenerator.js +1 -1
  18. package/dist/src/gl/includes/picking.vertex.glsl.js +1 -1
  19. package/dist/src/marks/link.common.glsl.js +1 -1
  20. package/dist/src/marks/link.d.ts.map +1 -1
  21. package/dist/src/marks/link.js +14 -22
  22. package/dist/src/marks/link.vertex.glsl.js +1 -1
  23. package/dist/src/marks/mark.d.ts +9 -0
  24. package/dist/src/marks/mark.d.ts.map +1 -1
  25. package/dist/src/marks/mark.js +19 -0
  26. package/dist/src/marks/rect.vertex.glsl.js +1 -1
  27. package/dist/src/spec/mark.d.ts +1 -1
  28. package/dist/src/utils/animator.d.ts +5 -4
  29. package/dist/src/utils/animator.d.ts.map +1 -1
  30. package/dist/src/utils/animator.js +34 -10
  31. package/dist/src/utils/inertia.d.ts +3 -1
  32. package/dist/src/utils/inertia.d.ts.map +1 -1
  33. package/dist/src/utils/inertia.js +10 -5
  34. package/dist/src/utils/iterateNestedMaps.d.ts +4 -3
  35. package/dist/src/utils/iterateNestedMaps.d.ts.map +1 -1
  36. package/dist/src/utils/iterateNestedMaps.js +3 -2
  37. package/dist/src/utils/radixSort.d.ts +9 -0
  38. package/dist/src/utils/radixSort.d.ts.map +1 -0
  39. package/dist/src/utils/radixSort.js +130 -0
  40. package/dist/src/utils/radixSort.test.js +51 -0
  41. package/dist/src/view/gridView.d.ts +3 -1
  42. package/dist/src/view/gridView.d.ts.map +1 -1
  43. package/dist/src/view/gridView.js +7 -6
  44. package/dist/src/view/zoom.d.ts.map +1 -1
  45. package/dist/src/view/zoom.js +23 -15
  46. package/package.json +2 -2
@@ -46,15 +46,21 @@ export function interactionToZoom(event, coords, handleZoom, hover, animator) {
46
46
  handleZoom = recordTimeStamp(handleZoom);
47
47
 
48
48
  if (event.type == "wheel") {
49
+ // TODO: Wheel-zoom inertia should probably be moved here and the faked wheel
50
+ // events in genomeSpy.js and inertia.js should be retired.
51
+
49
52
  event.uiEvent.preventDefault(); // TODO: Only if there was something zoomable
50
53
 
51
54
  const wheelEvent = /** @type {WheelEvent} */ (event.uiEvent);
52
55
  const wheelMultiplier = wheelEvent.deltaMode ? 120 : 1;
53
56
 
54
- if (wheelEvent.deltaX === 0 && wheelEvent.deltaY === 0) {
57
+ if (!wheelEvent.deltaX && !wheelEvent.deltaY) {
55
58
  return;
56
59
  }
57
60
 
61
+ // Stop drag-to-pan inertia
62
+ smoother?.stop();
63
+
58
64
  let { x, y } = event.point;
59
65
 
60
66
  // Snapping to the hovered item:
@@ -63,9 +69,6 @@ export function interactionToZoom(event, coords, handleZoom, hover, animator) {
63
69
  // This allows the user to rapidly zoom closer without having to
64
70
  // continuously adjust the cursor position.
65
71
 
66
- // Stop drag-to-pan inertia
67
- smoother?.stop();
68
-
69
72
  if (hover) {
70
73
  const e = hover.mark.encoders;
71
74
  if (e.x && !e.x2 && !e.x.constantValue) {
@@ -102,7 +105,7 @@ export function interactionToZoom(event, coords, handleZoom, hover, animator) {
102
105
  }
103
106
 
104
107
  /** @type {RingBuffer<{point: Point, timestamp: number}>} */
105
- const buffer = new RingBuffer(30);
108
+ const eventBuffer = new RingBuffer(30);
106
109
 
107
110
  const mouseEvent = /** @type {MouseEvent} */ (event.uiEvent);
108
111
  mouseEvent.preventDefault();
@@ -113,7 +116,7 @@ export function interactionToZoom(event, coords, handleZoom, hover, animator) {
113
116
  moveEvent
114
117
  ) => {
115
118
  const point = Point.fromMouseEvent(moveEvent);
116
- buffer.push({ point, timestamp: performance.now() });
119
+ eventBuffer.push({ point, timestamp: performance.now() });
117
120
 
118
121
  const delta = point.subtract(prevPoint);
119
122
 
@@ -132,7 +135,7 @@ export function interactionToZoom(event, coords, handleZoom, hover, animator) {
132
135
  const lastMillisToInclude = 160;
133
136
 
134
137
  const now = performance.now();
135
- const arr = buffer
138
+ const arr = eventBuffer
136
139
  .get()
137
140
  .filter((p) => now - p.timestamp < lastMillisToInclude);
138
141
 
@@ -148,25 +151,30 @@ export function interactionToZoom(event, coords, handleZoom, hover, animator) {
148
151
  .multiply(1 / (a.timestamp - b.timestamp));
149
152
 
150
153
  let x = prevPoint.x;
154
+ let y = prevPoint.y;
151
155
 
152
156
  smoother = makeLerpSmoother(
153
157
  animator,
154
- (a) => {
158
+ (p) => {
155
159
  handleZoom({
156
- x: a,
157
- y: prevPoint.y,
158
- xDelta: x - a,
159
- yDelta: 0,
160
+ x: p.x,
161
+ y: p.y,
162
+ xDelta: x - p.x,
163
+ yDelta: y - p.y,
160
164
  zDelta: 0,
161
165
  });
162
- x = a;
166
+ x = p.x;
167
+ y = p.y;
163
168
  },
164
169
  150,
165
170
  0.5,
166
- x
171
+ { x, y }
167
172
  );
168
173
 
169
- smoother(prevPoint.x - v.x * 250);
174
+ smoother({
175
+ x: prevPoint.x - v.x * 250,
176
+ y: prevPoint.y - v.y * 250,
177
+ });
170
178
  };
171
179
 
172
180
  const onMouseup = () => {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "contributors": [],
9
9
  "license": "MIT",
10
- "version": "0.48.0",
10
+ "version": "0.48.2",
11
11
  "jsdelivr": "dist/bundle/index.js",
12
12
  "unpkg": "dist/bundle/index.js",
13
13
  "browser": "dist/bundle/index.js",
@@ -64,5 +64,5 @@
64
64
  "vega-scale": "^7.3.1",
65
65
  "vega-util": "^1.17.2"
66
66
  },
67
- "gitHead": "64cd3335607b2608db3c85c74a4fb571302e77d0"
67
+ "gitHead": "f2817f82263b92e453356083f2d770b8b236f77a"
68
68
  }