提交 b99e334c 编写于 作者: L lang

Fix RoamController not sync with model when roamDetail is manually set

上级 82add8db
......@@ -228,6 +228,8 @@ define(function (require) {
var geo = mapOrGeoModel.coordinateSystem;
var controller = this._controller;
controller.zoomLimit = mapOrGeoModel.get('scaleLimit');
// Update zoom from model
controller.zoom = mapOrGeoModel.get('roamDetail.zoom');
// roamType is will be set default true if it is null
controller.enable(mapOrGeoModel.get('roam') || false);
// FIXME mainType, subType 作为 component 的属性?
......
......@@ -95,7 +95,7 @@ define(function (require) {
var pos = target.position;
var scale = target.scale;
var newZoom = this._zoom = this._zoom || 1;
var newZoom = this.zoom = this.zoom || 1;
newZoom *= zoomDelta;
if (zoomLimit) {
newZoom = Math.max(
......@@ -103,8 +103,8 @@ define(function (require) {
zoomLimit[0]
);
}
var zoomScale = newZoom / this._zoom;
this._zoom = newZoom;
var zoomScale = newZoom / this.zoom;
this.zoom = newZoom;
// Keep the mouse center when scaling
pos[0] -= (zoomX - pos[0]) * (zoomScale - 1);
pos[1] -= (zoomY - pos[1]) * (zoomScale - 1);
......@@ -144,6 +144,10 @@ define(function (require) {
*/
this.zoomLimit = null;
/**
* @type {number}
*/
this.zoom;
/**
* @type {module:zrender}
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册