comparison Applications/StoneWebViewer/WebApplication/app.js @ 1552:a4d82f1bcb10

user preferences: not for diagnostic use, software rendering
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Aug 2020 15:35:01 +0200
parents bf195fc0797e
children 6d14ed6163b1
comparison
equal deleted inserted replaced
1551:c54bc5bffd01 1552:a4d82f1bcb10
101 return { 101 return {
102 stone: stone, // To access global object "stone" from "index.html" 102 stone: stone, // To access global object "stone" from "index.html"
103 ready: false, 103 ready: false,
104 leftMode: 'grid', // Can be 'small', 'grid' or 'full' 104 leftMode: 'grid', // Can be 'small', 'grid' or 'full'
105 leftVisible: true, 105 leftVisible: true,
106 showWarning: false,
107 viewportLayoutButtonsVisible: false, 106 viewportLayoutButtonsVisible: false,
108 activeViewport: 0, 107 activeViewport: 0,
109 showInfo: true, 108 showInfo: true,
110 showReferenceLines: true, 109 showReferenceLines: true,
110
111 modalWarning: false,
112 modalNotDiagnostic: false,
113 modalPreferences: false,
114
115 // User preferences (stored in the local storage)
116 settingNotDiagnostic: true,
117 settingSoftwareRendering: false,
111 118
112 viewport1Width: '100%', 119 viewport1Width: '100%',
113 viewport1Height: '100%', 120 viewport1Height: '100%',
114 viewport1Left: '0%', 121 viewport1Left: '0%',
115 viewport1Top: '0%', 122 viewport1Top: '0%',
175 leftVisible: function(newVal, oldVal) { 182 leftVisible: function(newVal, oldVal) {
176 this.FitContent(); 183 this.FitContent();
177 }, 184 },
178 showReferenceLines: function(newVal, oldVal) { 185 showReferenceLines: function(newVal, oldVal) {
179 stone.ShowReferenceLines(newVal ? 1 : 0); 186 stone.ShowReferenceLines(newVal ? 1 : 0);
187 },
188 settingNotDiagnostic: function(newVal, oldVal) {
189 localStorage.settingNotDiagnostic = (newVal ? '1' : '0');
190 },
191 settingSoftwareRendering: function(newVal, oldVal) {
192 localStorage.settingSoftwareRendering = (newVal ? '1' : '0');
180 } 193 }
181 }, 194 },
182 methods: { 195 methods: {
183 FitContent() { 196 FitContent() {
184 // This function can be used even if WebAssembly is not initialized yet 197 // This function can be used even if WebAssembly is not initialized yet
449 InvertContrast() { 462 InvertContrast() {
450 var canvas = this.GetActiveCanvas(); 463 var canvas = this.GetActiveCanvas();
451 if (canvas != '') { 464 if (canvas != '') {
452 stone.InvertContrast(canvas); 465 stone.InvertContrast(canvas);
453 } 466 }
467 },
468
469 ApplyPreferences() {
470 this.modalPreferences = false;
471
472 if ((stone.IsSoftwareRendering() != 0) != this.settingSoftwareRendering) {
473 document.location.reload();
474 }
454 } 475 }
455 }, 476 },
456 477
457 mounted: function() { 478 mounted: function() {
458 this.SetViewportLayout('1x1'); 479 this.SetViewportLayout('1x1');
480
481 if (localStorage.settingNotDiagnostic) {
482 this.settingNotDiagnostic = (localStorage.settingNotDiagnostic == '1');
483 }
484
485 if (localStorage.settingSoftwareRendering) {
486 this.settingSoftwareRendering = (localStorage.settingSoftwareRendering == '1');
487 }
488
489 this.modalNotDiagnostic = this.settingNotDiagnostic;
459 } 490 }
460 }); 491 });
461 492
462 493
463 494
464 window.addEventListener('StoneInitialized', function() { 495 window.addEventListener('StoneInitialized', function() {
465 stone.Setup(Module); 496 stone.Setup(Module);
466 stone.SetOrthancRoot('..', true); 497 stone.SetOrthancRoot('..', true);
498 stone.SetSoftwareRendering(localStorage.settingSoftwareRendering == '1');
467 console.warn('Native Stone properly intialized'); 499 console.warn('Native Stone properly intialized');
468 500
469 var study = getParameterFromUrl('study'); 501 var study = getParameterFromUrl('study');
470 var series = getParameterFromUrl('series'); 502 var series = getParameterFromUrl('series');
471 503
563 595
564 $(document).ready(function() { 596 $(document).ready(function() {
565 // Enable support for tooltips in Bootstrap 597 // Enable support for tooltips in Bootstrap
566 //$('[data-toggle="tooltip"]').tooltip(); 598 //$('[data-toggle="tooltip"]').tooltip();
567 599
568 //app.showWarning = true; 600 //app.modalWarning = true;
569 601
570 602
571 $('#windowing-popover').popover({ 603 $('#windowing-popover').popover({
572 container: 'body', 604 container: 'body',
573 content: $('#windowing-content').html(), 605 content: $('#windowing-content').html(),