You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "noodleslove (via GitHub)" <gi...@apache.org> on 2026/09/30 04:15:26 UTC
[I] [Bug] Toolbox brush icon "Clear Selections" stays highlighted after being clicked [echarts]
noodleslove opened a new issue, #21771:
URL: https://github.com/apache/echarts/issues/21771
### Version
6.1.0
### Link to Minimal Reproduction
https://echarts.apache.org/examples/en/editor.html?code=PYBwLglsB2AEC8sDeAoWszGAGwEbAA8AuZNdWCMAUwFsBlCALypICYAGAGjPQHpfYAOWAAnGgENsFAMYwAziQAm4kQGtYAcxHiAngDpYACQgaAFthOnqimfJKjx0DVT09b0OmB3YWyWPhFFKhEAYRxREgByAGIAZnjI2ABfbnJYWhBTcTkIBT8IWQ8vHxIkf1Eg0PCRKIcnKkSk5NTyADMqcTAAVxFfVDT0CQ0CgBUdED6Mcd8AbUiLaAbOWEjcFUiAXWa3dFwRLrlTUqS3E_QUsj2Do78CAEECXIBJaCDiWHZt9HvHvP7yLwTKLSTpUDSiHSRFroZRgcQkOYAWRgUJWIy6SxWAHUqIpUZERqYuviAGIiCD4uidSldaCbMgXdA6B65Y4tOTBCBUPIzNz_NKA3yrdbQ8iw-GwGYARg4yw4XFgUoArAqABwKgDsCqlUu1sXYG1OZENSQA3CggA
### Steps to Reproduce
1. Open the link above.
2. Click the toolbox icon "Box Select".
3. Drag in the chart to brush an area.
4. Click the toolbox icon "Switch to Line Chart". Anything else that triggers a full update works too.
5. 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
```markdown
- OS: macOS
- Browser: Chrome 153
- Framework: none
```
### Any additional comments?
It can also be reproduced on the current `master`.
**Cause**
- The status of the brush icons is only calculated in `render` and `updateView` of the toolbox brush feature (`src/component/toolbox/feature/Brush.ts`).
- The action `brush` is registered with `update: 'updateVisual'` (`src/component/brush/install.ts`), and it is the only action that uses it. `ToolboxView` does not implement `updateVisual`, so the icons are not updated when the brushed areas are changed.
- Clicking "Clear Selections" dispatches `axisAreaSelect` first, which triggers a full update while the areas still exist, and then `brush` with `command: '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:
1. Implement `updateVisual` in `ToolboxView` and delegate it to `updateView`.
2. Apply the icon status by `api.enterEmphasis` / `api.leaveEmphasis` instead of the ones in `util/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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [I] [Bug] Toolbox brush icon "Clear Selections" stays highlighted after being clicked [echarts]
Posted by "plainheart (via GitHub)" <gi...@apache.org>.
plainheart commented on issue #21771:
URL: https://github.com/apache/echarts/issues/21771#issuecomment-5904003866
PR is welcome. Please target to the `release` branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org