Skip to content

Commit

Permalink
fix: fix geo can not be restored. fix #11670 .
Browse files Browse the repository at this point in the history
  • Loading branch information
100pah committed Jan 13, 2020
1 parent c201b68 commit 2264b0d
Show file tree
Hide file tree
Showing 3 changed files with 398 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/component/helper/MapDraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ MapDraw.prototype = {
var regionsGroup = this._regionsGroup;
var group = this.group;

if (geo._roamTransformable.transform) {
group.transform = Array.prototype.slice.call(geo._roamTransformable.transform);
group.decomposeTransform();
}
var transformInfo = geo.getTransformInfo();
group.transform = transformInfo.roamTransform;
group.decomposeTransform();
group.dirty();

var scale = geo._rawTransformable.scale;
var position = geo._rawTransformable.position;
var scale = transformInfo.rawScale;
var position = transformInfo.rawPosition;

regionsGroup.removeAll();

Expand Down
11 changes: 10 additions & 1 deletion src/coord/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ View.prototype = {
/**
* Remove roam
*/

_updateCenterAndZoom: function () {
// Must update after view transform updated
var rawTransformMatrix = this._rawTransformable.getLocalTransform();
Expand Down Expand Up @@ -229,6 +228,16 @@ View.prototype = {
this.decomposeTransform();
},

getTransformInfo: function () {
var roamTransform = this._roamTransformable.transform;
var rawTransformable = this._rawTransformable;
return {
roamTransform: roamTransform ? zrUtil.slice(roamTransform) : matrix.create(),
rawScale: zrUtil.slice(rawTransformable.scale),
rawPosition: zrUtil.slice(rawTransformable.position)
};
},

/**
* @return {module:zrender/core/BoundingRect}
*/
Expand Down
Loading

0 comments on commit 2264b0d

Please sign in to comment.