changeset 2050:b2738d7a388d

Prevent dragging series before they are ready
author Alain Mazy <am@osimis.io>
date Thu, 30 Mar 2023 12:56:04 +0200
parents f36de3ba43c8
children 27213468a3bf
files Applications/StoneWebViewer/NEWS Applications/StoneWebViewer/WebApplication/app.js
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/NEWS	Fri Dec 23 17:30:12 2022 +0100
+++ b/Applications/StoneWebViewer/NEWS	Thu Mar 30 12:56:04 2023 +0200
@@ -3,6 +3,11 @@
 
 * New button "Stretch to whole range" in the "Change windowing" menu
 
+Maintenance
+-----------
+
+* Prevent dragging series before they are ready
+
 
 Version 2.5 (2022-12-05)
 ========================
--- a/Applications/StoneWebViewer/WebApplication/app.js	Fri Dec 23 17:30:12 2022 +0100
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Thu Mar 30 12:56:04 2023 +0200
@@ -805,13 +805,17 @@
     },
     
     SeriesDragStart: function(event, seriesIndex) {
-      // It is necessary to use ".toString()" for Microsoft Edge Legacy (*)
-      event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
+      if (this.series[seriesIndex].numberOfFrames > 0) { // prevent dragging before the series metadata have been loaded
+        // It is necessary to use ".toString()" for Microsoft Edge Legacy (*)
+        event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
+      }
     },
 
     VirtualSeriesDragStart: function(event, seriesIndex, virtualSeriesId) {
-      event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
-      event.dataTransfer.setData('virtualSeriesId', virtualSeriesId.toString());
+      if (this.series[seriesIndex].numberOfFrames > 0) { // prevent dragging before the series metadata have been loaded
+        event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
+        event.dataTransfer.setData('virtualSeriesId', virtualSeriesId.toString());
+      }
     },
 
     SetViewportSeriesInstanceUid: function(viewportIndex, seriesInstanceUid) {