comparison Applications/StoneWebViewer/WebApplication/app.js @ 1820:5baaad557d58

don't change mouse tool after creating an annotation
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 May 2021 13:08:49 +0200
parents b81775f1b196
children a56bf4c534ef
comparison
equal deleted inserted replaced
1819:fe402c678d18 1820:5baaad557d58
34 var MODALITY = '0008,0060'; 34 var MODALITY = '0008,0060';
35 var PATIENT_BIRTH_DATE = '0010,0030'; 35 var PATIENT_BIRTH_DATE = '0010,0030';
36 36
37 // Registry of the PDF series for which the instance metadata is still waiting 37 // Registry of the PDF series for which the instance metadata is still waiting
38 var pendingSeriesPdf_ = {}; 38 var pendingSeriesPdf_ = {};
39
40 var MOUSE_TOOL_COMBINED = 1;
41 var MOUSE_TOOL_ZOOM = 2;
42 var MOUSE_TOOL_PAN = 3;
43 var MOUSE_TOOL_CROSSHAIR = 4;
44 var MOUSE_TOOL_CREATE_SEGMENT = 5;
45 var MOUSE_TOOL_CREATE_ANGLE = 6;
46 var MOUSE_TOOL_CREATE_CIRCLE = 7;
47 var MOUSE_TOOL_REMOVE_MEASURE = 8;
39 48
40 49
41 function getParameterFromUrl(key) { 50 function getParameterFromUrl(key) {
42 var url = window.location.search.substring(1); 51 var url = window.location.search.substring(1);
43 var args = url.split('&'); 52 var args = url.split('&');
389 showReferenceLines: true, 398 showReferenceLines: true,
390 synchronizedBrowsing: false, 399 synchronizedBrowsing: false,
391 globalConfiguration: {}, 400 globalConfiguration: {},
392 creatingArchive: false, 401 creatingArchive: false,
393 archiveJob: '', 402 archiveJob: '',
394 annotationsCurrentAction: stone.WebViewerAction.NONE, // dummy value 403 mouseTool: 0,
395 annotationsBackupAction: stone.WebViewerAction.NONE, // dummy value
396 404
397 modalWarning: false, 405 modalWarning: false,
398 modalNotDiagnostic: false, 406 modalNotDiagnostic: false,
399 modalPreferences: false, 407 modalPreferences: false,
400 408
652 this.viewport4Content = { 660 this.viewport4Content = {
653 series: series, 661 series: series,
654 sopInstanceUid: info.sopInstanceUid 662 sopInstanceUid: info.sopInstanceUid
655 }; 663 };
656 } 664 }
657
658 this.ResetAnnotationsAction();
659 }, 665 },
660 666
661 ClickSeries: function(seriesIndex) { 667 ClickSeries: function(seriesIndex) {
662 this.SetViewportSeries(this.activeViewport, { 668 this.SetViewportSeries(this.activeViewport, {
663 seriesIndex: seriesIndex 669 seriesIndex: seriesIndex
751 this.layoutCountX = 1; 757 this.layoutCountX = 1;
752 this.layoutCountY = 2; 758 this.layoutCountY = 2;
753 } 759 }
754 760
755 this.FitContent(); 761 this.FitContent();
756 this.ResetAnnotationsAction();
757 }, 762 },
758 763
759 UpdateSeriesThumbnail: function(seriesInstanceUid) { 764 UpdateSeriesThumbnail: function(seriesInstanceUid) {
760 if (seriesInstanceUid in this.seriesIndex) { 765 if (seriesInstanceUid in this.seriesIndex) {
761 var index = this.seriesIndex[seriesInstanceUid]; 766 var index = this.seriesIndex[seriesInstanceUid];
861 866
862 HideAllTooltips: function() { 867 HideAllTooltips: function() {
863 $('[data-toggle="tooltip"]').tooltip('hide'); 868 $('[data-toggle="tooltip"]').tooltip('hide');
864 }, 869 },
865 870
866 SetMouseButtonActions: function(left, middle, right) { 871 SetMouseButtonActions: function(tool, left, middle, right) {
867 this.mouseActionsVisible = false; 872 this.mouseActionsVisible = false;
868 this.annotationsBackupAction = stone.WebViewerAction.NONE; 873 this.mouseTool = tool;
869 stone.SetMouseButtonActions(left, middle, right); 874 stone.SetMouseButtonActions(left, middle, right);
870 }, 875 },
871 876
872 SetAnnotationsAction: function(action) { 877 SetLeftMouseButtonAction: function(tool, left) {
873 if (this.annotationsCurrentAction == action) { 878 this.mouseActionsVisible = false;
874 this.ResetAnnotationsAction(); 879 this.mouseTool = tool;
875 } else { 880 stone.SetMouseButtonActions(left, stone.GetMiddleMouseButtonAction(),
876 this.annotationsCurrentAction = action; 881 stone.GetRightMouseButtonAction());
877 882 },
878 if (this.annotationsBackupAction == stone.WebViewerAction.NONE) {
879 this.annotationsBackupAction = stone.GetLeftMouseButtonAction();
880 }
881
882 stone.SetMouseButtonActions(action,
883 stone.GetMiddleMouseButtonAction(),
884 stone.GetRightMouseButtonAction());
885 }
886 },
887
888 ResetAnnotationsAction: function() {
889 if (this.annotationsBackupAction != stone.WebViewerAction.NONE) {
890 stone.SetMouseButtonActions(this.annotationsBackupAction,
891 stone.GetMiddleMouseButtonAction(),
892 stone.GetRightMouseButtonAction());
893 }
894
895 this.annotationsBackupAction = stone.WebViewerAction.NONE;
896 this.annotationsCurrentAction = stone.WebViewerAction.NONE;
897 },
898 883
899 LoadOsiriXAnnotations: function(xml, clearPrevious) 884 LoadOsiriXAnnotations: function(xml, clearPrevious)
900 { 885 {
901 if (stone.LoadOsiriXAnnotations(xml, clearPrevious)) { 886 if (stone.LoadOsiriXAnnotations(xml, clearPrevious)) {
902 var seriesInstanceUid = stone.GetStringBuffer(); 887 var seriesInstanceUid = stone.GetStringBuffer();
967 if (behaviour !== undefined) { 952 if (behaviour !== undefined) {
968 left = ConvertMouseAction(behaviour['LeftMouseButton'], left); 953 left = ConvertMouseAction(behaviour['LeftMouseButton'], left);
969 middle = ConvertMouseAction(behaviour['MiddleMouseButton'], middle); 954 middle = ConvertMouseAction(behaviour['MiddleMouseButton'], middle);
970 right = ConvertMouseAction(behaviour['RightMouseButton'], right); 955 right = ConvertMouseAction(behaviour['RightMouseButton'], right);
971 } 956 }
972 957
973 this.SetMouseButtonActions(left, middle, right); 958 this.SetMouseButtonActions(MOUSE_TOOL_COMBINED, left, middle, right);
974 }, 959 },
975 960
976 CheckIsDownloadComplete: function() 961 CheckIsDownloadComplete: function()
977 { 962 {
978 if (this.creatingArchive && 963 if (this.creatingArchive &&
1070 var seriesInstanceUid = args.detail.seriesInstanceUid; 1055 var seriesInstanceUid = args.detail.seriesInstanceUid;
1071 that.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid); 1056 that.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid);
1072 }); 1057 });
1073 1058
1074 window.addEventListener('StoneAnnotationAdded', function() { 1059 window.addEventListener('StoneAnnotationAdded', function() {
1075 that.ResetAnnotationsAction(); 1060 // Ignore
1076 }); 1061 });
1077 1062
1078 window.addEventListener('StoneAnnotationRemoved', function() { 1063 window.addEventListener('StoneAnnotationRemoved', function() {
1079 that.ResetAnnotationsAction(); 1064 // Ignore
1080 }); 1065 });
1081 } 1066 }
1082 }); 1067 });
1083 1068
1084 1069