daybrush / selecto

Selecto.js is a component that allows you to select elements in the drag area using the mouse or touch.

Home Page:https://daybrush.com/selecto

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: `toggleContinueSelect` & `toggleContinueSelectWithoutDeselect`

SidIcarus opened this issue · comments

Environments

Description

Use case 1:

  • no element is selected
  • toggleContinueSelect key is pressed
    • in my example, shift is used
  • element is clicked on to be selected

problem: element is selected and immediately deselected

Use case 2:

  • While selecting multiple elements with toggleContinueSelect, if you have elements selected and their parentElement is selected
  • select parent and deselect children

problem: parent is selected, and immediately deselected

I've seen your suggestion in #97; enabling toggleContinueSelectWithoutDeselect with the same value as toggleContinueSelect resolves the problems above but then I am unable to deselect elements using that same key.

Would you have any suggestions on how to go about resolving the above?

Note: I have resolved the inverse of Use case 2 (parent is first selected then children are attempted to be selected using toggleContinueSelect) in the link I provided.

@SidIcarus

thanks.

  • The problem in Case 1 has been identified and will be corrected.
  • The problem in Case 2 will be checked and corrected.

@SidIcarus

you can check by isTrusted event property in Moveable (0.43.1)

Moveable

<Moveable 
      onClick={e => {
          if (e.isTrusted) {
              selecto.clickTarget(e.inputEvent, e.inputTarget);
          }
      }}
      onClickGroup={e => {
          if (e.isTrusted) {
              selecto.clickTarget(e.inputEvent, e.moveableTarget);
          }
      }}
/>

Thank you!