提交 a7aaf66a 编写于 作者: L lang

Clone is always deep

上级 50b6d14f
......@@ -28,6 +28,8 @@ define(function(require) {
// 最小高度改为0
barMinHeight: 0,
// barMaxWidth: null,
// 默认自适应
// barWidth: null,
// 柱间距离,默认为柱形宽度的30%,可设固定值
......@@ -52,8 +54,6 @@ define(function(require) {
// color: '各异',
// 柱条边线
barBorderColor: '#fff',
// 柱条边线圆角,单位px,默认为0
barBorderRadius: 0,
// 柱条边线线宽,单位px,默认为1
barBorderWidth: 0
},
......@@ -61,8 +61,6 @@ define(function(require) {
// color: '各异',
// 柱条边线
barBorderColor: '#fff',
// 柱条边线圆角,单位px,默认为0
barBorderRadius: 0,
// 柱条边线线宽,单位px,默认为1
barBorderWidth: 0
}
......
......@@ -149,7 +149,7 @@ define(function (require) {
seriesOpt.name = dataOpt.name;
for (var i = 1; i < dataList.length; i++) {
var dataOpt = dataList[i];
var newSeriesOpt = zrUtil.clone(seriesOpt, true);
var newSeriesOpt = zrUtil.clone(seriesOpt);
option.series.push(zrUtil.extend(newSeriesOpt, {
name: dataOpt.name,
data: dataOpt.value,
......
......@@ -50,7 +50,7 @@ define(function (require) {
* @type {Object}
* @readOnly
*/
this.opt = zrUtil.clone(opt, true);
this.opt = zrUtil.clone(opt);
/**
* @type {module:zrender/container/Group}
......@@ -131,7 +131,7 @@ define(function (require) {
// TODO
// Only support one interval yet.
if (ranges) {
renderCover.call(this, zrUtil.clone(ranges, true));
renderCover.call(this, zrUtil.clone(ranges));
}
},
......@@ -218,7 +218,7 @@ define(function (require) {
renderCover.call(this, ranges);
this.trigger('selected', zrUtil.clone(ranges, true));
this.trigger('selected', zrUtil.clone(ranges));
}
}
......
......@@ -635,7 +635,7 @@ define(function (require) {
function makeIcon(timelineModel, objPath, rect, opts) {
var icon = graphic.makePath(
timelineModel.get(objPath).replace(/^path:\/\//, ''),
zrUtil.clone(opts || {}, true),
zrUtil.clone(opts || {}),
new BoundingRect(rect[0], rect[1], rect[2], rect[3]),
'center'
);
......
......@@ -151,7 +151,7 @@ define(function(require) {
var newItem;
if (zrUtil.isObject(item)) {
newItem = zrUtil.clone(item, true);
newItem = zrUtil.clone(item);
newItem.value = index;
}
else {
......
......@@ -790,14 +790,14 @@ define(function (require) {
if (lastHover.payloadBatch && !contentNotChange) {
this._api.dispatchAction({
type: 'downplay',
batch: zrUtil.clone(lastHover.payloadBatch, true)
batch: zrUtil.clone(lastHover.payloadBatch)
});
}
// Dispatch highlight action
if (!contentNotChange) {
this._api.dispatchAction({
type: 'highlight',
batch: zrUtil.clone(payloadBatch, true)
batch: zrUtil.clone(payloadBatch)
});
lastHover.payloadBatch = payloadBatch;
}
......
......@@ -56,7 +56,7 @@ define(function(require) {
this.resetVisual(function (mappingOption, state) {
mappingOption.mappingMethod = mappingMethod;
mappingOption.categories = categories && zrUtil.clone(categories, true);
mappingOption.categories = categories && zrUtil.clone(categories);
var intervals = mappingOption.intervals = [];
var specifiedVisuals = mappingOption.specifiedVisuals = [];
......
......@@ -150,7 +150,7 @@ define(function(require) {
*/
_onItemClick: function (index) {
var visualMapModel = this.visualMapModel;
var selected = zrUtil.clone(visualMapModel.get('selected'), true);
var selected = zrUtil.clone(visualMapModel.get('selected'));
if (visualMapModel.get('selectedMode') === 'single') {
zrUtil.each(selected, function (item, index) {
......
......@@ -389,12 +389,12 @@ define(function(require) {
// Consistent symbol and symbolSize if not specified.
if (!visuals.symbol) {
visuals.symbol = symbolExists
&& zrUtil.clone(symbolExists, true)
&& zrUtil.clone(symbolExists)
|| (isCategory ? 'roundRect' : ['roundRect']);
}
if (!visuals.symbolSize) {
visuals.symbolSize = symbolSizeExists
&& zrUtil.clone(symbolSizeExists, true)
&& zrUtil.clone(symbolSizeExists)
|| (isCategory ? itemSize[0] : [itemSize[0], itemSize[0]]);
}
......
......@@ -47,7 +47,7 @@ define(function(require) {
* @public
*/
setActiveIntervals: function (intervals) {
var activeIntervals = this.activeIntervals = zrUtil.clone(intervals, true);
var activeIntervals = this.activeIntervals = zrUtil.clone(intervals);
// Normalize
if (activeIntervals) {
......
......@@ -280,7 +280,7 @@ define(function(require) {
* Get axis layout.
*/
getAxisLayout: function (dim) {
return zrUtil.clone(this._axesLayout[dim], true);
return zrUtil.clone(this._axesLayout[dim]);
}
};
......
......@@ -83,7 +83,7 @@ define(function (require) {
* @type {Object}
* @private
*/
this._theme = zrUtil.clone(theme, true);
this._theme = zrUtil.clone(theme);
/**
* @type {Array.<module:echarts/view/Chart>}
......
......@@ -110,7 +110,7 @@ define(function (require) {
if (!ComponentModel.hasClass(mainType)) {
option[mainType] = option[mainType] == null
? zrUtil.clone(componentOption, true)
? zrUtil.clone(componentOption)
: zrUtil.merge(option[mainType], componentOption, true);
}
else {
......
......@@ -123,7 +123,7 @@ define(function (require) {
// Pending
clone: function () {
var Ctor = this.constructor;
return new Ctor(zrUtil.clone(this.option, true));
return new Ctor(zrUtil.clone(this.option));
},
setReadOnly: function (properties) {
......
......@@ -56,7 +56,7 @@ define(function (require) {
* @readOnly
* @type {Object}
*/
var thisOption = this.option = zrUtil.clone(option, true);
var thisOption = this.option = zrUtil.clone(option);
/**
* @private
......
......@@ -12,8 +12,7 @@ define(function (require) {
*/
get: function (visualType, key, isCategory) {
var value = zrUtil.clone(
(defaultOption[visualType] || {})[key],
true
(defaultOption[visualType] || {})[key]
);
return isCategory
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册