changeset 2162:4f224edac348

Remember the previous layout when re-opening the viewer
author Alain Mazy <am@orthanc.team>
date Thu, 03 Oct 2024 09:53:54 +0200
parents 917e40af6b45
children 0a2b450cec3a
files Applications/StoneWebViewer/NEWS Applications/StoneWebViewer/WebApplication/app.js
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/NEWS	Fri Sep 27 22:29:51 2024 +0200
+++ b/Applications/StoneWebViewer/NEWS	Thu Oct 03 09:53:54 2024 +0200
@@ -1,6 +1,8 @@
 Pending changes in the mainline
 ===============================
 
+* Remember the previous layout when re-opening the viewer.
+
 
 Version 2.6 (2024-08-31)
 ========================
--- a/Applications/StoneWebViewer/WebApplication/app.js	Fri Sep 27 22:29:51 2024 +0200
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Thu Oct 03 09:53:54 2024 +0200
@@ -960,7 +960,7 @@
         this.layoutCountX = 1;
         this.layoutCountY = 2;
       }
-
+      localStorage.setItem('layout', layout);
       this.FitContent();
     },
 
@@ -1369,7 +1369,11 @@
   mounted: function() {
     // Warning: In this function, the "stone" global object is not initialized yet!
     
-    this.SetViewportLayout('1x1');
+    if (localStorage.layout) {
+      this.SetViewportLayout(localStorage.layout);
+    } else {
+      this.SetViewportLayout('1x1');
+    }
 
     if (localStorage.settingNotDiagnostic) {
       this.settingNotDiagnostic = (localStorage.settingNotDiagnostic == '1');