You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature request or a solution for this issue! Currently there is no feature in the library for this issue or I could not find one. I hope there is an optimal solution for this problem.
Issue
I would like to change the area-selection initial position inside of onBeforeStart event handler.
Description about issue:
When the user moves the mouse over one item then there will displayed a button at the bottom left corner.
User will be able to copy the current item properties to the newly selected items by selecting a range.
And I want to change the area-selection start position to the center of the item when user starts copying.
Desired solution
This is how I imagine the solution for this issue:
constonBeforeStart=({ event }: SelectionEvent)=>{if(isCopy.current===true){// Change area selection initial position// ...}// Preventing select from right click, middle mouse or left clickreturnallowedButtons.current.includes(event.buttons);};
The text was updated successfully, but these errors were encountered:
Hey ho! It's been a while, but this is now possible with the following functions:
selection.getSelectables() - to get a list of all elements that are currently selectable.
selection.setAreaLocation({...}) - to adjust the location at any time.
Translated into code this may look like something like this:
selection.on('start',(evt)=>{// There may not be an event if the selection was triggered programmaticallyconststartElement=evt.event?.target;// Make sure the target is a selectable element and the user started the// selection inside an selectable element, and not just the boundariesif(startElementinstanceofHTMLElement&&selection.getSelectables().includes(startElement)){conststartElementRect=startElement.getBoundingClientRect();// "attach" the selection area to the top left corner of the elementselection.setAreaLocation({x1: startElementRect.x,y1: startElementRect.y});}})
Which would result in something like this:
Note
Keep in mind that translating the area also may change the selection itself if you move it too much, in the gif below it is exact at the corner, keeping the source element still selected at any time.
The feature will be available starting with v3.9.0 :)
Feature request or a solution for this issue! Currently there is no feature in the library for this issue or I could not find one. I hope there is an optimal solution for this problem.
Issue
I would like to change the area-selection initial position inside of
onBeforeStart
event handler.Description about issue:
Desired solution
This is how I imagine the solution for this issue:
The text was updated successfully, but these errors were encountered: