# HG changeset patch # User Sebastien Jodogne # Date 1622027329 -7200 # Node ID 5baaad557d58b2067f7384c5f08fc69bc459d4de # Parent fe402c678d18de36d4cd28200128a2a5f3af7474 don't change mouse tool after creating an annotation diff -r fe402c678d18 -r 5baaad557d58 Applications/StoneWebViewer/WebApplication/app.js --- a/Applications/StoneWebViewer/WebApplication/app.js Wed May 26 13:08:15 2021 +0200 +++ b/Applications/StoneWebViewer/WebApplication/app.js Wed May 26 13:08:49 2021 +0200 @@ -37,6 +37,15 @@ // Registry of the PDF series for which the instance metadata is still waiting var pendingSeriesPdf_ = {}; +var MOUSE_TOOL_COMBINED = 1; +var MOUSE_TOOL_ZOOM = 2; +var MOUSE_TOOL_PAN = 3; +var MOUSE_TOOL_CROSSHAIR = 4; +var MOUSE_TOOL_CREATE_SEGMENT = 5; +var MOUSE_TOOL_CREATE_ANGLE = 6; +var MOUSE_TOOL_CREATE_CIRCLE = 7; +var MOUSE_TOOL_REMOVE_MEASURE = 8; + function getParameterFromUrl(key) { var url = window.location.search.substring(1); @@ -391,8 +400,7 @@ globalConfiguration: {}, creatingArchive: false, archiveJob: '', - annotationsCurrentAction: stone.WebViewerAction.NONE, // dummy value - annotationsBackupAction: stone.WebViewerAction.NONE, // dummy value + mouseTool: 0, modalWarning: false, modalNotDiagnostic: false, @@ -654,8 +662,6 @@ sopInstanceUid: info.sopInstanceUid }; } - - this.ResetAnnotationsAction(); }, ClickSeries: function(seriesIndex) { @@ -753,7 +759,6 @@ } this.FitContent(); - this.ResetAnnotationsAction(); }, UpdateSeriesThumbnail: function(seriesInstanceUid) { @@ -863,39 +868,19 @@ $('[data-toggle="tooltip"]').tooltip('hide'); }, - SetMouseButtonActions: function(left, middle, right) { + SetMouseButtonActions: function(tool, left, middle, right) { this.mouseActionsVisible = false; - this.annotationsBackupAction = stone.WebViewerAction.NONE; + this.mouseTool = tool; stone.SetMouseButtonActions(left, middle, right); }, - SetAnnotationsAction: function(action) { - if (this.annotationsCurrentAction == action) { - this.ResetAnnotationsAction(); - } else { - this.annotationsCurrentAction = action; - - if (this.annotationsBackupAction == stone.WebViewerAction.NONE) { - this.annotationsBackupAction = stone.GetLeftMouseButtonAction(); - } - - stone.SetMouseButtonActions(action, - stone.GetMiddleMouseButtonAction(), - stone.GetRightMouseButtonAction()); - } + SetLeftMouseButtonAction: function(tool, left) { + this.mouseActionsVisible = false; + this.mouseTool = tool; + stone.SetMouseButtonActions(left, stone.GetMiddleMouseButtonAction(), + stone.GetRightMouseButtonAction()); }, - ResetAnnotationsAction: function() { - if (this.annotationsBackupAction != stone.WebViewerAction.NONE) { - stone.SetMouseButtonActions(this.annotationsBackupAction, - stone.GetMiddleMouseButtonAction(), - stone.GetRightMouseButtonAction()); - } - - this.annotationsBackupAction = stone.WebViewerAction.NONE; - this.annotationsCurrentAction = stone.WebViewerAction.NONE; - }, - LoadOsiriXAnnotations: function(xml, clearPrevious) { if (stone.LoadOsiriXAnnotations(xml, clearPrevious)) { @@ -969,8 +954,8 @@ middle = ConvertMouseAction(behaviour['MiddleMouseButton'], middle); right = ConvertMouseAction(behaviour['RightMouseButton'], right); } - - this.SetMouseButtonActions(left, middle, right); + + this.SetMouseButtonActions(MOUSE_TOOL_COMBINED, left, middle, right); }, CheckIsDownloadComplete: function() @@ -1072,11 +1057,11 @@ }); window.addEventListener('StoneAnnotationAdded', function() { - that.ResetAnnotationsAction(); + // Ignore }); window.addEventListener('StoneAnnotationRemoved', function() { - that.ResetAnnotationsAction(); + // Ignore }); } }); diff -r fe402c678d18 -r 5baaad557d58 Applications/StoneWebViewer/WebApplication/index.html --- a/Applications/StoneWebViewer/WebApplication/index.html Wed May 26 13:08:15 2021 +0200 +++ b/Applications/StoneWebViewer/WebApplication/index.html Wed May 26 13:08:49 2021 +0200 @@ -353,30 +353,34 @@
-
-
-
-
@@ -472,8 +476,8 @@
@@ -481,8 +485,8 @@
@@ -490,8 +494,8 @@
@@ -499,8 +503,8 @@