mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 20:58:11 +08:00
Fix hover transfer bugs occurring with the color picker popover (#4146)
* Fix hover transfer bugs occurring with the color picker popover * Code review fix
This commit is contained in:
@@ -35,7 +35,8 @@ const { subscribe, update } = store;
|
||||
export type ColorPickerStore = {
|
||||
subscribe: typeof subscribe;
|
||||
setCallbacks: (callbacks: ColorPickerCallbacks) => void;
|
||||
clearCallbacks: () => void;
|
||||
// Identity-checked so a hover-transfer race where another picker's `setCallbacks` already replaced these doesn't clobber the new picker's callbacks
|
||||
clearCallbacks: (expected: ColorPickerCallbacks) => void;
|
||||
setDragging: (dragging: boolean) => void;
|
||||
};
|
||||
|
||||
@@ -88,10 +89,12 @@ export function createColorPickerStore(subscriptions: SubscriptionsRouter): Colo
|
||||
return state;
|
||||
});
|
||||
},
|
||||
clearCallbacks: () => {
|
||||
clearCallbacks: (expected: ColorPickerCallbacks) => {
|
||||
update((state) => {
|
||||
state.callbacks = {};
|
||||
state.isDragging = false;
|
||||
if (state.callbacks === expected) {
|
||||
state.callbacks = {};
|
||||
}
|
||||
return state;
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user