[Bug] brushMode: 'multiple' is not working
Version
6
Link to Minimal Reproduction
https://echarts.apache.org/examples/en/editor.html?c=scatter-simple&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMgL4A0asAnjvkUmRQEYBOArngBZ0XpjDAAbRsAxEA2gHJmAUwDGYCaVgSA1tOkhFy2QOkBDZhIC65dOhbsOAWWAATaUQkBbVgMghdEig3R5pzCGlCWDEeZDDfSidhAQBlCAAvB1gAJgAGUzN0Wz0wPXEIszEARjSAOgzYAA4KgBYTQvQxGrSAdiUANjKATgBWBqyskoBmCqVWst6qgcGm7orepRqq4pnZkuKx6rLh4bXBktqtiY6O_aHi0drOspXzotKtrt37puKjyprus8z14pTJjcqilXiF5sVFrAJiCUIV7oUwJQQMkJHhZLkwP4vFkfGZULNEcjHGiMVjflk8FEYvEkkR0uTsrl8iFYbM3ptIdDQWJRmlhkojik9gyHgCUuNbsLGiEAWlxbAjrVWtzNmlIaMXiKmh9IUdvtyunyJSl6lqQv8nmUUj9pSVZUtbqbbRM0lUlL1biCzWIPXL3WUOtM4eTiBQjChiABuIA
Steps to Reproduce
- Click on 'box' selection on the toolbox.
- Draw 1 box.
- Draw another box. (The previous box is cleared)
Current Behavior
The brush selection is 'single' even setting the brushMode: 'multiple'
Expected Behavior
The brush selection should be 'multiple' like the behavior after the 'keep' toolbox feature.
Environment
- OS:Windows
- Browser: Edge
- Framework:Vue@3
Any additional comments?
No response
3. Draw another box. (The previous box is cleared)
That's because you need to select "Keep selections" first.
Other than that, brushMode: 'multiple' operates as intended - Demo.
However, there is a bug in inBrush.opacity, see Demo code. See also similar #11649.
- Draw another box. (The previous box is cleared)
That's because you need to select "Keep selections" first. Other than that,
brushMode: 'multiple'operates as intended - Demo.However, there is a bug in inBrush.opacity, see Demo code. See also similar #11649.
Then the option doesn't do anything. You can always click keep selection.
I want it as default. Is there anyway to do this programmatically?
I want it as default. Is there anyway to do this programmatically?
I think yes, if we know the name of the "Keep Selections" action (which is currently undocumented), it could be dispatched programmatically. Perhaps the name could be extracted from the source code by an expert...
Sorry, the "Keep Selections" action is documented and called takeGlobalCursor. Here is how to use it - Demo. 📌 please close issue if problem solved.
Sorry, the "Keep Selections" action is documented and called takeGlobalCursor. Here is how to use it - Demo. 📌 please close issue if problem solved.
Thanks for the solution. I tried this before without the setTimeout and it did not work. I'd consider it resolved if the following are optimized?
- The
brushMode: multipleoption should have the "keep selection" selected as default without the dispatch action. Otherwise the option should be considered defective or obsolete. - What is the reason for the
setTimeoutondispatchAction? Is it because it needs to wait for the canvas rendering to finish (at the start)?
- That's an
opinionoption which could be proposed as a new Feature - Yes
- That's an ~opinion~ option which could be proposed as a new Feature
- Yes
- The
brushmodeoption is listed in the docs. If setting it tomultipledoesn't actually do it, then it makes the following doc is incorrect? (The point is that even setting it assingle, you can still use thekeep selection(actually i think that's what the keep selection does. set it to multiple)
brush. brushMode = 'single' string Default brush mode, whose value can be:
'single': for single selection; 'multiple': for multiple selection.
ok, finally I understand - brushmode:'multiple' is expected to (and should) activate "Keep Selections", that makes sense.