Repository navigation
Description
Version
6.1.0
Link to Minimal Reproduction
Steps to Reproduce
- Open the link above.
- Click the toolbox icon "Box Select".
- Drag in the chart to brush an area.
- Click the toolbox icon "Switch to Line Chart". Anything else that triggers a full update works too.
- Click the toolbox icon "Clear Selections", and then move the mouse out of the icon.
Current Behavior
The highlight of the icon "Clear Selections" does not follow the brushed areas:
| Step | Brushed areas | "Clear Selections" |
|---|---|---|
| After step 3 | 1 | Not highlighted |
| After step 4 | 1 | Highlighted |
| After step 5 | 0 | Still highlighted |
It only goes back to normal after the next full update, for example, after clicking "Switch to Bar Chart".
Expected Behavior
The icon should be highlighted as soon as an area is brushed, and should go back to normal as soon as the areas are cleared.
Environment
- OS: macOS
- Browser: Chrome 153
- Framework: noneAny additional comments?
It can also be reproduced on the current master.
Cause
- The status of the brush icons is only calculated in
renderandupdateViewof the toolbox brush feature (src/component/toolbox/feature/Brush.ts). - The action
brushis registered withupdate: 'updateVisual'(src/component/brush/install.ts), and it is the only action that uses it.ToolboxViewdoes not implementupdateVisual, so the icons are not updated when the brushed areas are changed. - Clicking "Clear Selections" dispatches
axisAreaSelectfirst, which triggers a full update while the areas still exist, and thenbrushwithcommand: 'clear', which only updates visual. That is why the icon stays highlighted.
Relation to #21684
#21684 fixes that updateView and dispose of ToolboxView do nothing, because the HashMap of features is iterated by zrUtil.each. That fix is needed here, but it does not resolve this issue by itself. I applied it to master and the steps above give the same result.
Possible fix
On top of #21684:
- Implement
updateVisualinToolboxViewand delegate it toupdateView. - Apply the icon status by
api.enterEmphasis/api.leaveEmphasisinstead of the ones inutil/states, so that the states are applied in the next frame even if the status is changed out of a full update.
I have verified this locally and would like to make a pull request for it.
Activity
plainheart commentedon Sep 30, 2026
PR is welcome. Please target to the
releasebranch.