提交 3a80a47a 编写于 作者: P pissang

fix(toolbox): fix icon emphasis status not keep when selected.

上级 eb94696f
...@@ -143,8 +143,9 @@ class ToolboxView extends ComponentView { ...@@ -143,8 +143,9 @@ class ToolboxView extends ComponentView {
const iconPaths = this.iconPaths; const iconPaths = this.iconPaths;
option.iconStatus = option.iconStatus || {}; option.iconStatus = option.iconStatus || {};
option.iconStatus[iconName] = status; option.iconStatus[iconName] = status;
// FIXME if (iconPaths[iconName]) {
iconPaths[iconName] && iconPaths[iconName].trigger(status); graphic[status === 'emphasis' ? 'enterEmphasis' : 'leaveEmphasis'](iconPaths[iconName]);
}
}; };
if (feature instanceof ToolboxFeature) { if (feature instanceof ToolboxFeature) {
...@@ -240,9 +241,8 @@ class ToolboxView extends ComponentView { ...@@ -240,9 +241,8 @@ class ToolboxView extends ComponentView {
}, tooltipModel.option); }, tooltipModel.option);
} }
graphic.enableHoverEmphasis(path); // graphic.enableHoverEmphasis(path);
if (toolboxModel.get('showTitle')) {
(path as ExtendedPath).__title = titlesMap[iconName]; (path as ExtendedPath).__title = titlesMap[iconName];
(path as graphic.Path).on('mouseover', function () { (path as graphic.Path).on('mouseover', function () {
// Should not reuse above hoverStyle, which might be modified. // Should not reuse above hoverStyle, which might be modified.
...@@ -258,13 +258,23 @@ class ToolboxView extends ComponentView { ...@@ -258,13 +258,23 @@ class ToolboxView extends ComponentView {
path.setTextConfig({ path.setTextConfig({
position: iconStyleEmphasisModel.get('textPosition') || defaultTextPosition position: iconStyleEmphasisModel.get('textPosition') || defaultTextPosition
}); });
textContent.ignore = false; textContent.ignore = !toolboxModel.get('showTitle');
// Use enterEmphasis and leaveEmphasis provide by ec.
// There are flags managed by the echarts.
graphic.enterEmphasis(this);
}) })
.on('mouseout', function () { .on('mouseout', function () {
textContent.ignore = true; if (featureModel.get(['iconStatus', iconName]) !== 'emphasis') {
}); graphic.leaveEmphasis(this);
} }
path.trigger(featureModel.get(['iconStatus', iconName]) || 'normal'); textContent.hide();
});
graphic[
featureModel.get(['iconStatus', iconName]) === 'emphasis'
? 'enterEmphasis' : 'leaveEmphasis'
](path);
group.add(path); group.add(path);
(path as graphic.Path).on('click', zrUtil.bind( (path as graphic.Path).on('click', zrUtil.bind(
......
...@@ -1668,10 +1668,10 @@ class ECharts extends Eventful { ...@@ -1668,10 +1668,10 @@ class ECharts extends Eventful {
): void { ): void {
each(dirtyList || ecIns._componentsViews, function (componentView: ComponentView) { each(dirtyList || ecIns._componentsViews, function (componentView: ComponentView) {
const componentModel = componentView.__model; const componentModel = componentView.__model;
componentView.render(componentModel, ecModel, api, payload);
clearStates(componentModel, componentView); clearStates(componentModel, componentView);
componentView.render(componentModel, ecModel, api, payload);
updateZ(componentModel, componentView); updateZ(componentModel, componentView);
updateHoverEmphasisHandler(componentView); updateHoverEmphasisHandler(componentView);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册