selecto
selecto copied to clipboard
If the mouse is within a selectable node, hitRate doesn't work as expected
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:
- Set hitRate={100}. (the value doesn't actually matter, but 100 is the most obvious for the sake of the example)
- Start a dragging selection from outside
- 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!
@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.