diff options
author | srichman333 <sarah_n_richman@brown.edu> | 2023-11-06 18:36:58 -0500 |
---|---|---|
committer | srichman333 <sarah_n_richman@brown.edu> | 2023-11-06 18:36:58 -0500 |
commit | 1b412d402c77a2aae82cf86b1f6a23f8a4f82caf (patch) | |
tree | 7ebd22eeade12099d1d891d9f9b264f02956ad4a /src/client/util/SnappingManager.ts | |
parent | 7163062edec37cef9dd9ae6c123d987e83837463 (diff) | |
parent | a4e3b645317c4589cf49f8007f6e6b57cf2c12d3 (diff) |
Merge branch 'master' into dataViz-annotations
Diffstat (limited to 'src/client/util/SnappingManager.ts')
-rw-r--r-- | src/client/util/SnappingManager.ts | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/client/util/SnappingManager.ts b/src/client/util/SnappingManager.ts index ed9819fc0..c0cd94067 100644 --- a/src/client/util/SnappingManager.ts +++ b/src/client/util/SnappingManager.ts @@ -1,19 +1,20 @@ import { observable, action, runInAction } from 'mobx'; -import { computedFn } from 'mobx-utils'; import { Doc } from '../../fields/Doc'; 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() { this.vertSnapLines = []; this.horizSnapLines = []; } - @action public setSnapLines(horizLines: number[], vertLines: number[]) { - this.horizSnapLines = horizLines; - this.vertSnapLines = vertLines; + @action public addSnapLines(horizLines: number[], vertLines: number[]) { + this.horizSnapLines.push(...horizLines); + this.vertSnapLines.push(...vertLines); } } @@ -22,8 +23,8 @@ export namespace SnappingManager { export function clearSnapLines() { manager.clearSnapLines(); } - export function setSnapLines(horizLines: number[], vertLines: number[]) { - manager.setSnapLines(horizLines, vertLines); + export function addSnapLines(horizLines: number[], vertLines: number[]) { + manager.addSnapLines(horizLines, vertLines); } export function horizSnapLines() { return manager.horizSnapLines; @@ -35,14 +36,19 @@ export namespace SnappingManager { export function SetIsDragging(dragging: boolean) { runInAction(() => (manager.IsDragging = dragging)); } + 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 SetShowSnapLines(show: boolean) { - runInAction(() => (Doc.UserDoc().freeform_snapLines = show)); + export function GetIsResizing() { + return manager.IsResizing; } - export function GetShowSnapLines() { - return Doc.UserDoc().freeform_snapLines; + export function GetCanEmbed() { + return manager.CanEmbed; } } |