Commit 3010d5b291311df5041d1620265fc1f52cb4e1c9

Authored by xp.Huang
2 parents 9f945cdf e0ebe5f1

Merge branch 'feat/new-component-alarm-table' into 'main_dev'

fix: 修复组态预览时会进行内容最大化

See merge request yunteng/thingskit-scada!73
@@ -349,17 +349,17 @@ @@ -349,17 +349,17 @@
349 } 349 }
350 }; 350 };
351 </script> 351 </script>
352 - <link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/plgmlhohecdddhbmmkncjdmlhcmaachm">  
353 - <link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png"> 352 + <!-- <link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/plgmlhohecdddhbmmkncjdmlhcmaachm"> -->
  353 + <!-- <link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png"> -->
354 <!-- <link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">--> 354 <!-- <link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">-->
355 <link rel="icon" type="image/png" sizes="32x32" href="images/logo-32x32.png"> 355 <link rel="icon" type="image/png" sizes="32x32" href="images/logo-32x32.png">
356 - <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png"> 356 + <!-- <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png"> -->
357 <!-- <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">--> 357 <!-- <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">-->
358 <link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#d89000"> 358 <link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#d89000">
359 <link rel="stylesheet" type="text/css" href="styles/grapheditor.css"> 359 <link rel="stylesheet" type="text/css" href="styles/grapheditor.css">
360 - <link rel="preconnect" href="https://storage.googleapis.com"> 360 + <!-- <link rel="preconnect" href="https://storage.googleapis.com">
361 <link rel="canonical" href="https://app.diagrams.net"> 361 <link rel="canonical" href="https://app.diagrams.net">
362 - <link rel="manifest" href="images/manifest.json"> 362 + <link rel="manifest" href="images/manifest.json"> -->
363 <!-- <link rel="shortcut icon" href="favicon.ico">--> 363 <!-- <link rel="shortcut icon" href="favicon.ico">-->
364 <link rel="shortcut icon" href="images/logo-16x16.ico"> 364 <link rel="shortcut icon" href="images/logo-16x16.ico">
365 <style type="text/css"> 365 <style type="text/css">
@@ -3386,24 +3386,26 @@ EditorUi.prototype.lightboxFit = function(maxHeight) @@ -3386,24 +3386,26 @@ EditorUi.prototype.lightboxFit = function(maxHeight)
3386 } 3386 }
3387 3387
3388 // LATER: Use initial graph bounds to avoid rounding errors 3388 // LATER: Use initial graph bounds to avoid rounding errors
3389 - this.editor.graph.maxFitScale = this.lightboxMaxFitScale;  
3390 - this.editor.graph.fit(border, null, null, null, null, null, maxHeight); 3389 + // this.editor.graph.maxFitScale = this.lightboxMaxFitScale;
  3390 + // this.editor.graph.fit(border, null, null, null, null, null, maxHeight);
3391 // this.editor.graph.maxFitScale = null; 3391 // this.editor.graph.maxFitScale = null;
3392 - // TODO thingsKit lightbox 默认缩放为1 3392 + // // TODO thingsKit lightbox 默认缩放为1
3393 // console.log(this.editor.graph.view) 3393 // console.log(this.editor.graph.view)
3394 // this.editor.graph.view.setScale(1); 3394 // this.editor.graph.view.setScale(1);
3395 /// TODO thingsKit 设置内容最大化 3395 /// TODO thingsKit 设置内容最大化
3396 var margin = 2; 3396 var margin = 2;
3397 var max = 3; 3397 var max = 3;
3398 var graph = this.editor.graph 3398 var graph = this.editor.graph
3399 - 3399 + var pageFormat = graph.pageFormat
3400 var bounds = graph.getGraphBounds(); 3400 var bounds = graph.getGraphBounds();
3401 var cw = graph.container.clientWidth - margin; 3401 var cw = graph.container.clientWidth - margin;
3402 var ch = graph.container.clientHeight - margin; 3402 var ch = graph.container.clientHeight - margin;
3403 - var w = bounds.width / graph.view.scale;  
3404 - var h = bounds.height / graph.view.scale; 3403 + var w = pageFormat.width
  3404 + // var w = pageFormat.width / graph.view.scale;
  3405 + var h = pageFormat.height;
  3406 + // var h = pageFormat.height / graph.view.scale;
3405 var s = Math.min(max, Math.min(cw / w, ch / h)); 3407 var s = Math.min(max, Math.min(cw / w, ch / h));
3406 - 3408 + console.log({w, h, scale: graph.view.scale, cw, ch, s})
3407 graph.view.scaleAndTranslate(s, 3409 graph.view.scaleAndTranslate(s,
3408 (margin + cw - w * s) / (2 * s) - bounds.x / graph.view.scale, 3410 (margin + cw - w * s) / (2 * s) - bounds.x / graph.view.scale,
3409 (margin + ch - h * s) / (2 * s) - bounds.y / graph.view.scale); 3411 (margin + ch - h * s) / (2 * s) - bounds.y / graph.view.scale);