ananzhusen преди 1 година
родител
ревизия
8f6050dcd9
променени са 2 файла, в които са добавени 9 реда и са изтрити 6 реда
  1. 3 3
      src/views/Preview.vue
  2. 6 3
      src/views/components/View.vue

+ 3 - 3
src/views/Preview.vue

@@ -99,9 +99,9 @@ const opened = () => {
     (meta2d.store.data as any).scaleMode === '3'
       ? 'height'
       : (meta2d.store.data as any).scaleMode === '2'
-        ? 'width'
-        : true;
-  meta2d.fitSizeView(fit, 10);
+      ? 'width'
+      : true;
+  meta2d.fitSizeView(fit, 0);
   meta2d.setOptions({
     scroll: (meta2d.store.data as any).scroll,
     disableScale: (meta2d.store.data as any).isDisableScale,

+ 6 - 3
src/views/components/View.vue

@@ -1242,8 +1242,11 @@ const preview = async () => {
   //     id: data._id,
   //   },
   // });
-  let screenWidth = window.screen.width;
-  let screenHeight = window.screen.height;
+  // let screenWidth = window.screen.width;
+  // let screenHeight = window.screen.height;
+  let width = meta2d.store.data.width||meta2d.store.options.width||1920;
+  let height = meta2d.store.data.height||meta2d.store.options.height||1080;
+  let minScle  = Math.min(window.innerWidth/width,window.innerHeight/height);
   let url = `/preview?r=${Date.now() + ''}`;
   if (data.id) {
     url += `&id=${data.id}`;
@@ -1251,7 +1254,7 @@ const preview = async () => {
   window.open(
     url,
     '',
-    `height=${screenHeight},width=${screenWidth},top=0,left=0,toolbar=no,menubar=no, scrollbars=no,resizable=no,location=no, status=no`
+    `height=${minScle*height},width=${minScle*width},top=0,left=${(window.innerWidth-minScle*width)/2},toolbar=no,menubar=no, scrollbars=no,resizable=no,location=no, status=no`
   );
 };