Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the mouse is within a selectable node, hitRate doesn't work as expected #152

Open
SimeonRolev opened this issue Sep 20, 2023 · 1 comment
Labels
bug Something isn't working complete

Comments

@SimeonRolev
Copy link

Environments

  • Framework name: react-selecto
  • Framework version: 1.26.0
  • Component name:
  • Component version:
  • Testable Address(optional):

Description

Issue and reproduction

The example from the documentation could be used as a reproduction:

  1. Set hitRate={100}. (the value doesn't actually matter, but 100 is the most obvious for the sake of the example)
  2. Start a dragging selection from outside
  3. The box becomes selected the moment the mouse enters it. It ignores the requirement for 100% coverage.
    https://codesandbox.io/s/85wdcj

Expected behavior

The box gets selected only if it's fully covered by the blue selection rectangle.

My workaround

selectFromInside={false} doesn't seem to change this. Strangely enough selectByClick={false} seems to fix it, but in that case the regular click-select stops working. So, I did this:

      const [isDragging, setIsDragging] = useState(false);

    /* ... */
        <Selecto
          selectableTargets={[".selectable"]}
          hitRate={100}
          selectByClick={!isDragging}
          onDrag={() => setIsDragging(true)}
          onDragEnd={() => setIsDragging(false)}
          toggleContinueSelect={'shift'}
          onSelect={({ selected }) => {
            setSelection(selected)
          }}
        />

This worked for my case, but seems more like a hack, at least the used properties' names don't state what they actually do. Is there a better way to achieve this?

Thanks!

@daybrush daybrush added the bug Something isn't working label Nov 4, 2023
@daybrush
Copy link
Owner

@SimeonRolev

  • lit-selecto 1.26.1
  • preact-selecto 1.23.1
  • react-selecto 1.26.1
  • selecto 1.26.1
  • svelte-selecto 1.26.1
  • vue-selecto 1.26.1
  • vue3-selecto 1.12.1
  • ngx-selecto 1.26.1

selecto's new version is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working complete
Projects
None yet
Development

No branches or pull requests

2 participants