|
@@ -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);
|