修改代码

This commit is contained in:
ival 2019-07-19 18:01:42 +08:00
parent 80ef1f9ee3
commit a1a2b1d21e
3 changed files with 4 additions and 5 deletions

View File

@ -46,6 +46,7 @@ class Jmap {
this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {})); // 缩放 this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {})); // 缩放
this.$painter = new Painter(this); this.$painter = new Painter(this);
this.$painter.updateZrSize({width: this.$zr.getWidth(), height: this.$zr.getHeight()});
this.$painter.updateTransform(this.$options); this.$painter.updateTransform(this.$options);
this.optionsHandler = this.setOptions.bind(this); this.optionsHandler = this.setOptions.bind(this);

View File

@ -17,7 +17,7 @@ class Painter {
this.initPainterLevels(); this.initPainterLevels();
// 视图控制器 // 视图控制器
this.$transformHandle = new TransformHandle(this, this.$zr); this.$transformHandle = new TransformHandle(this);
} }
/** /**

View File

@ -21,15 +21,13 @@ function createBoundingRect(view) {
} }
class TransformHandle { class TransformHandle {
constructor(painter, zr) { constructor(painter) {
this.$painter = painter; this.$painter = painter;
this.$zr = zr;
this.parentLevel = this.$painter.getParentLevel(); this.parentLevel = this.$painter.getParentLevel();
console.log(this.parentLevel, 1111); this.rect = { x: 0, y: 0, width: 0, height: 0 };
this.rect = { x: 0, y: 0, width: this.$zr.getWidth(), height: this.$zr.getHeight() };
this.transform = createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 }); this.transform = createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 });
} }