aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/SnappingManager.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-11-02 19:30:19 -0400
committerbobzel <zzzman@gmail.com>2023-11-02 19:30:19 -0400
commiteec81f7e0b53395e3e2ea25663a9ea06ec83085d (patch)
treebb10e997cf9d5d0719049723de5728279bf67b0d /src/client/util/SnappingManager.ts
parent1bba63b1d15cfe76393424a768d2dbc0f0b8cffb (diff)
performance fixes - don't invalidate as much by using reactions in place of computd values; don't make things active when things are dragged unless CanEmbed; fix for linkBox to use reaction.
Diffstat (limited to 'src/client/util/SnappingManager.ts')
-rw-r--r--src/client/util/SnappingManager.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client/util/SnappingManager.ts b/src/client/util/SnappingManager.ts
index 3cb41ab4d..c0cd94067 100644
--- a/src/client/util/SnappingManager.ts
+++ b/src/client/util/SnappingManager.ts
@@ -5,6 +5,7 @@ export namespace SnappingManager {
class Manager {
@observable IsDragging: boolean = false;
@observable IsResizing: Doc | undefined;
+ @observable CanEmbed: boolean = false;
@observable public horizSnapLines: number[] = [];
@observable public vertSnapLines: number[] = [];
@action public clearSnapLines() {
@@ -38,10 +39,16 @@ export namespace SnappingManager {
export function SetIsResizing(doc: Doc | undefined) {
runInAction(() => (manager.IsResizing = doc));
}
+ export function SetCanEmbed(canEmbed: boolean) {
+ runInAction(() => (manager.CanEmbed = canEmbed));
+ }
export function GetIsDragging() {
return manager.IsDragging;
}
export function GetIsResizing() {
return manager.IsResizing;
}
+ export function GetCanEmbed() {
+ return manager.CanEmbed;
+ }
}