# HG changeset patch # User Sebastien Jodogne # Date 1606237687 -3600 # Node ID f2e8b3ac1dcd1249806af9876fbfd24aafb7c479 # Parent 03afa09cfcf1db023f1c67c8d14b4eaeae187c41 handling multiple windowing presets in the Stone web viewer diff -r 03afa09cfcf1 -r f2e8b3ac1dcd Applications/StoneWebViewer/WebApplication/app.js --- a/Applications/StoneWebViewer/WebApplication/app.js Tue Nov 24 16:39:54 2020 +0100 +++ b/Applications/StoneWebViewer/WebApplication/app.js Tue Nov 24 18:08:07 2020 +0100 @@ -300,6 +300,9 @@ viewport4Visible: false, viewport4Series: {}, + showWindowing: false, + windowingPresets: [], + series: [], studies: [], seriesIndex: {} // Maps "SeriesInstanceUID" to "index in this.series" @@ -617,19 +620,13 @@ }, SetWindowing: function(center, width) { + this.showWindowing = false; var canvas = this.GetActiveCanvas(); if (canvas != '') { stone.SetWindowing(canvas, center, width); } }, - SetPresetWindowing: function() { - var canvas = this.GetActiveCanvas(); - if (canvas != '') { - stone.SetPresetWindowing(canvas); - } - }, - InvertContrast: function() { var canvas = this.GetActiveCanvas(); if (canvas != '') { @@ -679,6 +676,27 @@ stone.FocusFirstOsiriXAnnotation('canvas1'); } + }, + + ToggleWindowing: function() + { + if (this.showWindowing) + { + this.showWindowing = false; + } + else + { + stone.LoadWindowingPresets(this.GetActiveCanvas()); + this.windowingPresets = JSON.parse(stone.GetStringBuffer()); + + var p = $('#windowing-popover').last(); + var top = p.offset().top + p.height() + 10; + $('#windowing-content').css('top', top); + //$('#windowing-content').css('right', '10'); + //$('#windowing-content').css('left', 'auto'); + + this.showWindowing = true; + } } }, @@ -783,17 +801,6 @@ //app.modalWarning = true; - $('#windowing-popover').popover({ - container: 'body', - content: $('#windowing-content').html(), - template: '', - placement: 'auto', - html: true, - sanitize: false, - trigger: 'focus' // Close on click - }); - - var wasmSource = 'StoneWebViewer.js'; // Option 1: Loading script using plain HTML diff -r 03afa09cfcf1 -r f2e8b3ac1dcd Applications/StoneWebViewer/WebApplication/index.html --- a/Applications/StoneWebViewer/WebApplication/index.html Tue Nov 24 16:39:54 2020 +0100 +++ b/Applications/StoneWebViewer/WebApplication/index.html Tue Nov 24 18:08:07 2020 +0100 @@ -367,11 +367,64 @@
+
+
+

Change windowing

+ +
+
- - + - - - -