@jax-data-science/sci-image-visualizer 0.8.1 → 0.8.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.
@@ -13397,6 +13397,10 @@ class VisualizerComponent {
13397
13397
  * the newer render's overlay, or applying its ROIs.
13398
13398
  */
13399
13399
  this.renderToken = 0;
13400
+ /** Set once the template, and with it the plot div, exists (see ngAfterViewInit). */
13401
+ this.viewReady = false;
13402
+ /** An image-less dataset whose draw waits for the view: see plotSpatialWithoutImage. */
13403
+ this.pendingSpatialDraw = null;
13400
13404
  this.zIndex = 0;
13401
13405
  this.maxIndex = 0;
13402
13406
  this.contextMenuItems = [];
@@ -14444,6 +14448,20 @@ class VisualizerComponent {
14444
14448
  requestAnimationFrame(() => this.renderIntensityInset());
14445
14449
  };
14446
14450
  window.addEventListener('resize', this.profileResizeListener);
14451
+ this.onViewReady();
14452
+ }
14453
+ /** The plot div exists now: run an image-less draw that arrived before it did. */
14454
+ onViewReady() {
14455
+ this.viewReady = true;
14456
+ const pending = this.pendingSpatialDraw;
14457
+ this.pendingSpatialDraw = null;
14458
+ // Only if it is still the dataset on offer and no image has arrived meanwhile. By id, not by
14459
+ // object: the port may re-emit the same dataset as a new object (a colour-column change does),
14460
+ // and then the current object is the one to draw.
14461
+ const current = this.spatialDataset;
14462
+ if (pending && current && current.id === pending.id && !this.imageInfo) {
14463
+ void this.plotSpatialWithoutImage(current);
14464
+ }
14447
14465
  }
14448
14466
  onProfilePanelDragStart(e) {
14449
14467
  this.profilePanelDragging = true;
@@ -14740,6 +14758,13 @@ class VisualizerComponent {
14740
14758
  * dataset, so regions drawn here are kept per dataset like any image's.
14741
14759
  */
14742
14760
  async plotSpatialWithoutImage(dataset) {
14761
+ if (!this.viewReady) {
14762
+ // A host that creates the visualizer AFTER publishing the dataset (jit-ui opening a file
14763
+ // from its tree) has it replayed into ngOnInit, before the template and its plot div
14764
+ // exist; drawing now finds no target. Draw once the view is ready (onViewReady).
14765
+ this.pendingSpatialDraw = dataset;
14766
+ return;
14767
+ }
14743
14768
  // The same generation as the image pipeline: a newer image or dataset supersedes this
14744
14769
  // draw, and a superseded draw neither reports nor releases the newer one's loading state.
14745
14770
  const token = ++this.renderToken;