diff options
author | Andy Rickert <andrew_rickert@brown.edu> | 2020-05-12 17:37:54 -0700 |
---|---|---|
committer | Andy Rickert <andrew_rickert@brown.edu> | 2020-05-12 17:37:54 -0700 |
commit | 9ad062907d38a7a853ba89fa31433380ae3cd7b3 (patch) | |
tree | 707855e1bc6fa8ac3d1f51447815a51eb83b8aa3 /src/client/util/SnappingManager.ts | |
parent | 1848c78f889470d6c558f709efe1b521402b2793 (diff) | |
parent | 4bd011dcc6a3f009fa10932c7c6ca1932b784fde (diff) |
merge
Diffstat (limited to 'src/client/util/SnappingManager.ts')
-rw-r--r-- | src/client/util/SnappingManager.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/client/util/SnappingManager.ts b/src/client/util/SnappingManager.ts new file mode 100644 index 000000000..fc07e8ab4 --- /dev/null +++ b/src/client/util/SnappingManager.ts @@ -0,0 +1,29 @@ +import { observable, action, runInAction } from "mobx"; + +export namespace SnappingManager { + + class Manager { + @observable IsDragging: 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; + } + } + + const manager = new Manager(); + + export function clearSnapLines() { manager.clearSnapLines(); } + export function setSnapLines(horizLines: number[], vertLines: number[]) { manager.setSnapLines(horizLines, vertLines); } + export function horizSnapLines() { return manager.horizSnapLines; } + export function vertSnapLines() { return manager.vertSnapLines; } + + export function SetIsDragging(dragging: boolean) { runInAction(() => manager.IsDragging = dragging); } + export function GetIsDragging() { return manager.IsDragging; } +} + |