提交 4f38ef42 编写于 作者: 1 100pah

[treemap] Fix #4291 (treemap breadcrumb do not work correctly after setOption with not-merge mode)

上级 b7af9857
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
var ITEM_GAP = 8; var ITEM_GAP = 8;
var ARRAY_LENGTH = 5; var ARRAY_LENGTH = 5;
function Breadcrumb(containerGroup, onSelect) { function Breadcrumb(containerGroup) {
/** /**
* @private * @private
* @type {module:zrender/container/Group} * @type {module:zrender/container/Group}
...@@ -17,19 +17,13 @@ ...@@ -17,19 +17,13 @@
this.group = new graphic.Group(); this.group = new graphic.Group();
containerGroup.add(this.group); containerGroup.add(this.group);
/**
* @private
* @type {Function}
*/
this._onSelect = onSelect || zrUtil.noop;
} }
Breadcrumb.prototype = { Breadcrumb.prototype = {
constructor: Breadcrumb, constructor: Breadcrumb,
render: function (seriesModel, api, targetNode) { render: function (seriesModel, api, targetNode, onSelect) {
var model = seriesModel.getModel('breadcrumb'); var model = seriesModel.getModel('breadcrumb');
var thisGroup = this.group; var thisGroup = this.group;
...@@ -60,7 +54,7 @@ ...@@ -60,7 +54,7 @@
}; };
this._prepare(targetNode, layoutParam, textStyleModel); this._prepare(targetNode, layoutParam, textStyleModel);
this._renderContent(seriesModel, layoutParam, normalStyleModel, textStyleModel); this._renderContent(seriesModel, layoutParam, normalStyleModel, textStyleModel, onSelect);
layout.positionGroup(thisGroup, layoutParam.pos, layoutParam.box); layout.positionGroup(thisGroup, layoutParam.pos, layoutParam.box);
}, },
...@@ -86,7 +80,7 @@ ...@@ -86,7 +80,7 @@
* @private * @private
*/ */
_renderContent: function ( _renderContent: function (
seriesModel, layoutParam, normalStyleModel, textStyleModel seriesModel, layoutParam, normalStyleModel, textStyleModel, onSelect
) { ) {
// Start rendering. // Start rendering.
var lastX = 0; var lastX = 0;
...@@ -126,7 +120,7 @@ ...@@ -126,7 +120,7 @@
} }
), ),
z: 10, z: 10,
onclick: zrUtil.bind(this._onSelect, this, itemNode) onclick: zrUtil.curry(onSelect, itemNode)
}); });
this.group.add(el); this.group.add(el);
......
...@@ -544,8 +544,8 @@ ...@@ -544,8 +544,8 @@
} }
} }
(this._breadcrumb || (this._breadcrumb = new Breadcrumb(this.group, bind(onSelect, this)))) (this._breadcrumb || (this._breadcrumb = new Breadcrumb(this.group)))
.render(seriesModel, api, targetInfo.node); .render(seriesModel, api, targetInfo.node, bind(onSelect, this));
function onSelect(node) { function onSelect(node) {
if (this._state !== 'animating') { if (this._state !== 'animating') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册