clean up internal state when clearing selection
This commit is contained in:
parent
ddbcabcecf
commit
824d98b9c8
1 changed files with 4 additions and 0 deletions
|
@ -100,6 +100,8 @@ export function SelectionProvider<K, T extends object>(props: ParentProps<{ sele
|
||||||
},
|
},
|
||||||
clear() {
|
clear() {
|
||||||
setState('selection', []);
|
setState('selection', []);
|
||||||
|
internal.modifier[1](Modifier.None);
|
||||||
|
internal.latest[1](undefined);
|
||||||
},
|
},
|
||||||
isSelected(key) {
|
isSelected(key) {
|
||||||
return createMemo(() => state.selection.includes(key));
|
return createMemo(() => state.selection.includes(key));
|
||||||
|
@ -257,6 +259,8 @@ export function selectable<K, T extends object>(element: HTMLElement, options: A
|
||||||
return SelectionMode.Normal;
|
return SelectionMode.Normal;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
console.log(modifier(), withRange, mode);
|
||||||
|
|
||||||
context.select(withRange ? createRange(latest(), element) : [key], { mode });
|
context.select(withRange ? createRange(latest(), element) : [key], { mode });
|
||||||
|
|
||||||
if (!withRange) {
|
if (!withRange) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue