fix(toolbox): update brush icon status when brushed areas change; fix features never updated or disposed. close #21771 - #21773
Open
noodleslove wants to merge 1 commit into
Open
noodleslove wants to merge 1 commit into
noodleslove wants to merge 1 commit into
Conversation
…en the brushed areas are changed, e.g., the icon "clear" stays highlighted after clicked. (2) Fix that the features are not updated and disposed, since the HashMap of features is iterated incorrectly. close apache#21771
|
Thanks for your contribution! Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only. |
noodleslove
marked this pull request as ready for review
September 30, 2026 19:27
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief Information
This pull request is in the type of:
What does this PR do?
Update the status of the toolbox brush icons as soon as the brushed areas are changed, and fix that the toolbox features are never updated or disposed.
Fixed issues
Details
Before: What was the problem?
The highlight of the brush icon "Clear Selections" did not follow the brushed areas. With a brush component and the toolbox brush feature:
It only went back to normal after the next full update.
Two causes:
renderandupdateViewof the brush feature. The actionbrushis registered withupdate: 'updateVisual', whichToolboxViewdid not handle. So the icons were not updated when the areas were changed. When "Clear Selections" is clicked,axisAreaSelectis dispatched first, which triggers a full update while the areas still exist, and thenbrushwithcommand: 'clear', which only updates visual. That is why the icon stayed highlighted.ToolboxView._featuresis aHashMap, butupdateViewanddisposeiterated it withzrUtil.each, which only visits the internaldataproperty. So both methods have done nothing since 6de824d. The features were never updated byupdateView, and never disposed.After: How does it behave after the fixing?
The icon "Clear Selections" is highlighted as soon as an area is brushed, and goes back to normal as soon as the areas are cleared. The other icons are not affected. The features are disposed when the chart is disposed.
Changes in
src/component/toolbox/ToolboxView.ts:_featureswith its owneachinupdateViewanddispose.updateVisual, which delegates toupdateView, so that the features can update the icon status after the actions that only update visual.api.enterEmphasis/api.leaveEmphasisinstead of the functions inutil/states, so that the states are applied in the next frame even if the status is changed out of a full update.Document Info
One of the following should be checked.
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
test/toolbox-brush-iconStatus.htmltest/ut/spec/component/toolbox/brushIconStatus.test.ts. All of the four cases fail without the fix.Merging options
Other information
releaseas requested in [Bug] Toolbox brush icon "Clear Selections" stays highlighted after being clicked #21771._features) is the same as fix(toolbox): fix updateView and dispose silently no-oping on toolbox features #21684, which targetsmasterand is not merged yet. It is required here, sincereleasedoes not have it andupdateVisualrelies onupdateView. Please feel free to decide how to reconcile the two.select.iconStylefor toolbox icons, for Add selected state style for toolbox magicType buttons #21672, targetingmaster) that changes the same lines ofToolboxView.ts. Whichever is merged later will need a small conflict resolution; I will handle it.