Просмотр исходного кода

Keep dtdesign dialog window within browser window bounds.

Joeri Exelmans 2 лет назад
Родитель
Сommit
58b07c1a20
1 измененных файлов с 10 добавлено и 2 удалено
  1. 10 2
      src/main/webapp/myPlugins/dtdesign.js

+ 10 - 2
src/main/webapp/myPlugins/dtdesign.js

@@ -512,8 +512,11 @@ fetch(BACKEND+"/version")
   }
 
   const wnd = new mxWindow("ModelVerse", wndDiv,
-    getSetting("dialogPosX"), getSetting("dialogPosY"),
-    getSetting("dialogWidth"), getSetting("dialogHeight"),
+    // make sure the plugin popup window is always within the bounds of the browser window:
+    Math.max(0, Math.min(getSetting("dialogPosX"), window.innerWidth-getSetting("dialogWidth"))),
+    Math.max(0, Math.min(getSetting("dialogPosY"), window.innerHeight-getSetting("dialogHeight"))),
+    getSetting("dialogWidth"),
+    getSetting("dialogHeight"),
     true, true);
     wnd.destroyOnClose = false;
     wnd.setMaximizable(false);
@@ -533,5 +536,10 @@ fetch(BACKEND+"/version")
 
   wnd.show();
 
+  window.onresize = event => {
+    console.log(wnd);
+    console.log(event);
+  }
+
 }) // end of promise that checks the backend version.
 })