@genome-spy/core 0.21.0 → 0.23.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/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "contributors": [],
9
9
  "license": "BSD-2-Clause",
10
- "version": "0.21.0",
10
+ "version": "0.23.0",
11
11
  "main": "dist/index.js",
12
12
  "module": "src/index.js",
13
13
  "exports": {
@@ -53,5 +53,5 @@
53
53
  "vega-scale": "^7.1.1",
54
54
  "vega-util": "^1.16.0"
55
55
  },
56
- "gitHead": "293e743d4b887427d8fadc49460a08a572eaff12"
56
+ "gitHead": "7420b51a4344e39985db59396ddf873eb3002143"
57
57
  }
@@ -63,6 +63,9 @@ void main(void) {
63
63
  float semanticThresholdFactor = computeSemanticThresholdFactor();
64
64
  if (semanticThresholdFactor <= 0.0) {
65
65
  gl_PointSize = 0.0;
66
+ // Place the vertex outside the viewport. The default (0, 0) makes this super-slow
67
+ // on Apple Silicon. Probably related to the tile-based GPU architecture.
68
+ gl_Position = vec4(100.0, 0.0, 0.0, 0.0);
66
69
  // Exit early. MAY prevent some unnecessary calculations.
67
70
  return;
68
71
  }
@@ -108,6 +108,24 @@ export default class ContainerView extends View {
108
108
  }
109
109
  }
110
110
 
111
+ /**
112
+ *
113
+ * @param {string} name
114
+ */
115
+ findDescendantByName(name) {
116
+ /** @type {View} */
117
+ let view;
118
+
119
+ this.visit((v) => {
120
+ if (v.name == name) {
121
+ view = v;
122
+ return VISIT_STOP;
123
+ }
124
+ });
125
+
126
+ return view;
127
+ }
128
+
111
129
  /**
112
130
  * @param {import("../spec/channel").Channel | "default"} channel
113
131
  * @param {ResolutionTarget} resolutionType
@@ -522,6 +522,27 @@ export default class ScaleResolution {
522
522
  }
523
523
  }
524
524
 
525
+ /**
526
+ * Resets the current domain to the initial one
527
+ *
528
+ * @returns true if the domain was changed
529
+ */
530
+ resetZoom() {
531
+ if (!this.isZoomable()) {
532
+ throw new Error("Not a zoomable scale!");
533
+ }
534
+
535
+ const oldDomain = this.getDomain();
536
+ const newDomain = this.getInitialDomain();
537
+
538
+ if ([0, 1].some((i) => newDomain[i] != oldDomain[i])) {
539
+ this._scale.domain(newDomain);
540
+ this._notifyDomainListeners();
541
+ return true;
542
+ }
543
+ return false;
544
+ }
545
+
525
546
  /**
526
547
  * Returns the zoom level with respect to the reference domain span (the original domain).
527
548
  *