diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-10-15 22:26:16 +0530 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-10-15 22:26:16 +0530 |
commit | 3b81903962ac10bbf87013e045c7fdf101fea9ec (patch) | |
tree | dcee81b1fb07c18966272c32975da3899e512228 /src/client/util/SnappingManager.ts | |
parent | ae57452f05cca70a498e826fb3320bd2182ba88b (diff) | |
parent | 377d5c987728c2678ab38565328f1f7ad9f3d135 (diff) |
merging
Diffstat (limited to 'src/client/util/SnappingManager.ts')
-rw-r--r-- | src/client/util/SnappingManager.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/client/util/SnappingManager.ts b/src/client/util/SnappingManager.ts index fc07e8ab4..069f81d38 100644 --- a/src/client/util/SnappingManager.ts +++ b/src/client/util/SnappingManager.ts @@ -1,4 +1,5 @@ import { observable, action, runInAction } from "mobx"; +import { computedFn } from "mobx-utils"; export namespace SnappingManager { @@ -14,6 +15,9 @@ export namespace SnappingManager { this.horizSnapLines = horizLines; this.vertSnapLines = vertLines; } + + @observable cachedGroups: string[] = []; + @action setCachedGroups(groups: string[]) { this.cachedGroups = groups; } } const manager = new Manager(); @@ -25,5 +29,11 @@ export namespace SnappingManager { export function SetIsDragging(dragging: boolean) { runInAction(() => manager.IsDragging = dragging); } export function GetIsDragging() { return manager.IsDragging; } + + /// bcz; argh!! TODO; These do not belong here, but there were include order problems with leaving them in util.ts + // need to investigate further what caused the mobx update problems and move to a better location. + const getCachedGroupByNameCache = computedFn(function (name: string) { return manager.cachedGroups.includes(name); }, true); + export function GetCachedGroupByName(name: string) { return getCachedGroupByNameCache(name); } + export function SetCachedGroups(groups: string[]) { manager.setCachedGroups(groups); } } |