Mercurial > hg > orthanc-stone
diff Applications/StoneWebViewer/WebApplication/app.js @ 1681:f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 24 Nov 2020 18:08:07 +0100 |
parents | 51bab5188a13 |
children | 4a49de03a419 |
line wrap: on
line diff
--- 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: '<div class="popover wvToolbar__windowingPresetConfigPopover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>', - placement: 'auto', - html: true, - sanitize: false, - trigger: 'focus' // Close on click - }); - - var wasmSource = 'StoneWebViewer.js'; // Option 1: Loading script using plain HTML