# HG changeset patch # User Sebastien Jodogne # Date 1621958872 -7200 # Node ID b81775f1b19658f1568ac4d7f2eed416a25b7dc2 # Parent 53f3411bf94b692dc310161a04076936eba15157 New tools for annotations: segment length, circle, angle and eraser diff -r 53f3411bf94b -r b81775f1b196 Applications/StoneWebViewer/NEWS --- a/Applications/StoneWebViewer/NEWS Tue May 25 15:52:38 2021 +0200 +++ b/Applications/StoneWebViewer/NEWS Tue May 25 18:07:52 2021 +0200 @@ -1,6 +1,7 @@ Pending changes in the mainline =============================== +* New tools for annotations: segment length, circle, angle and eraser * Patient birth date is now displayed in the overlays * New argument "token" to set HTTP header "Authorization: Bearer " for each request to the DICOMweb server diff -r 53f3411bf94b -r b81775f1b196 Applications/StoneWebViewer/WebApplication/app.js --- a/Applications/StoneWebViewer/WebApplication/app.js Tue May 25 15:52:38 2021 +0200 +++ b/Applications/StoneWebViewer/WebApplication/app.js Tue May 25 18:07:52 2021 +0200 @@ -391,6 +391,8 @@ globalConfiguration: {}, creatingArchive: false, archiveJob: '', + annotationsCurrentAction: stone.WebViewerAction.NONE, // dummy value + annotationsBackupAction: stone.WebViewerAction.NONE, // dummy value modalWarning: false, modalNotDiagnostic: false, @@ -652,6 +654,8 @@ sopInstanceUid: info.sopInstanceUid }; } + + this.ResetAnnotationsAction(); }, ClickSeries: function(seriesIndex) { @@ -749,6 +753,7 @@ } this.FitContent(); + this.ResetAnnotationsAction(); }, UpdateSeriesThumbnail: function(seriesInstanceUid) { @@ -860,9 +865,37 @@ SetMouseButtonActions: function(left, middle, right) { this.mouseActionsVisible = false; + this.annotationsBackupAction = stone.WebViewerAction.NONE; 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()); + } + }, + + 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)) { @@ -1037,6 +1070,14 @@ var seriesInstanceUid = args.detail.seriesInstanceUid; that.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid); }); + + window.addEventListener('StoneAnnotationAdded', function() { + that.ResetAnnotationsAction(); + }); + + window.addEventListener('StoneAnnotationRemoved', function() { + that.ResetAnnotationsAction(); + }); } }); @@ -1144,7 +1185,6 @@ - function ParseJsonWithComments(json) { if (typeof(json) == 'string') { diff -r 53f3411bf94b -r b81775f1b196 Applications/StoneWebViewer/WebApplication/index.html --- a/Applications/StoneWebViewer/WebApplication/index.html Tue May 25 15:52:38 2021 +0200 +++ b/Applications/StoneWebViewer/WebApplication/index.html Tue May 25 18:07:52 2021 +0200 @@ -472,6 +472,8 @@
@@ -479,6 +481,8 @@
@@ -486,6 +490,8 @@
@@ -493,6 +499,15 @@
+
+ +
+