提交 fa89024a 编写于 作者: L lang

scaleLimit is a {min, max} object

上级 8ef4fac0
......@@ -6,7 +6,7 @@ define(function (require) {
* Calculate pan and zoom which from roamDetail model
* @param {module:echarts/model/Model} roamDetailModel
* @param {Object} payload
* @param {Array.<number>} [zoomLimit]
* @param {Object} [zoomLimit]
*/
roamHelper.calcPanAndZoom = function (
roamDetailModel, payload, zoomLimit
......@@ -27,8 +27,8 @@ define(function (require) {
if (zoom != null) {
if (zoomLimit) {
zoom = Math.max(
Math.min(previousZoom * zoom, zoomLimit[1]),
zoomLimit[0]
Math.min(previousZoom * zoom, zoomLimit.max),
zoomLimit.min
) / previousZoom;
}
var fixX = (payload.originX - panX) * (zoom - 1);
......
......@@ -99,8 +99,8 @@ define(function (require) {
newZoom *= zoomDelta;
if (zoomLimit) {
newZoom = Math.max(
Math.min(zoomLimit[1], newZoom),
zoomLimit[0]
Math.min(zoomLimit.max, newZoom),
zoomLimit.min
);
}
var zoomScale = newZoom / this.zoom;
......@@ -140,9 +140,10 @@ define(function (require) {
this.rect = rect;
/**
* @type {Array.<number>}
* { min: 1, max: 2 }
* @type {Object}
*/
this.zoomLimit = null;
this.zoomLimit;
/**
* @type {number}
......
......@@ -121,7 +121,7 @@ define(function (require) {
var zoomLimit = this.zoomLimit;
if (zoomLimit) {
zoom = Math.max(
Math.min(zoom, zoomLimit[1]), zoomLimit[0]
Math.min(zoom, zoomLimit.max), zoomLimit.min
);
}
......
......@@ -259,7 +259,10 @@
geo: {
map: 'china',
roam: true,
scaleLimit: [1, 2],
scaleLimit: {
min: 1,
max: 2
},
roamDetail: {
x: -200,
y: -200,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册