Closed britneydossett closed 1 year ago
Oh, I figured it out. For those wondering, I created a variable and whenever someone clicks shift
, then I set selectByClick
to true in the keydown event.
<script>
let clickable = false
</script>
<Selecto
selectableTargets={['.cell']}
dragContainer={document.body}
hitRate={40}
selectByClick={clickable}
selectFromInside={false}
toggleContinueSelect={'shift'}
on:selectStart={({ detail: e }) => {
e.added.forEach(el => {
el.classList.add('selected')
})
e.removed.forEach(el => {
el.classList.remove('selected')
})
}}
on:selectEnd={({ detail: e }) => {
e.afterAdded.forEach(el => {
el.classList.add('selected')
})
e.afterRemoved.forEach(el => {
el.classList.remove('selected')
})
if (e.selected.length === 0) {
clickable = false
}
}}
on:keydown={e => {
e.preventDefault()
clickable = true
}}
/>
Environments
Description
Hi! I was wondering if it's possible to use
shift-click
to select elements on click initially, instead of just clicking the element?Shift-click
works after I have selected other elements, however we don't want every item to be selectable every time you click it, because sometimes it interferes with the editability of that element.For example, when I click on the cell surrounding Heading 3, I am not able to click to edit Heading 3. I would like to be able to
shift-click
it for selection and click it normally to edit.Thank you!