mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
feat: masks, properties refactor, shaders, storage migrations, and more
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
type CancelFn = () => void;
|
||||
|
||||
const cancellers = new Set<CancelFn>();
|
||||
|
||||
export function registerCanceller({ fn }: { fn: CancelFn }): () => void {
|
||||
cancellers.add(fn);
|
||||
|
||||
return () => {
|
||||
cancellers.delete(fn);
|
||||
};
|
||||
}
|
||||
|
||||
export function cancelInteraction(): boolean {
|
||||
if (cancellers.size === 0) return false;
|
||||
|
||||
const activeCancellers = Array.from(cancellers);
|
||||
cancellers.clear();
|
||||
|
||||
for (const cancel of activeCancellers) {
|
||||
cancel();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user