diff options
Diffstat (limited to 'src/client/util/SnappingManager.ts')
-rw-r--r-- | src/client/util/SnappingManager.ts | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/client/util/SnappingManager.ts b/src/client/util/SnappingManager.ts index 359140732..eb47bbe88 100644 --- a/src/client/util/SnappingManager.ts +++ b/src/client/util/SnappingManager.ts @@ -1,7 +1,7 @@ -import { observable, action, runInAction, reaction, makeObservable } from 'mobx'; -import { Doc, Opt } from '../../fields/Doc'; +import { observable, action, runInAction, makeObservable } from 'mobx'; export class SnappingManager { + // eslint-disable-next-line no-use-before-define private static _manager: SnappingManager; private static get Instance() { return SnappingManager._manager ?? new SnappingManager(); @@ -12,7 +12,7 @@ export class SnappingManager { @observable _metaKey = false; @observable _isLinkFollowing = false; @observable _isDragging: boolean = false; - @observable _isResizing: Doc | undefined = undefined; + @observable _isResizing: string | undefined = undefined; // the string is the Id of the document being resized @observable _canEmbed: boolean = false; @observable _horizSnapLines: number[] = []; @observable _vertSnapLines: number[] = []; @@ -23,7 +23,9 @@ export class SnappingManager { makeObservable(this); } - @action public static clearSnapLines = () => (this.Instance._vertSnapLines.length = this.Instance._horizSnapLines.length = 0); + @action public static clearSnapLines = () => { + this.Instance._vertSnapLines.length = this.Instance._horizSnapLines.length = 0; + }; @action public static addSnapLines = (horizLines: number[], vertLines: number[]) => { this.Instance._horizSnapLines.push(...horizLines); this.Instance._vertSnapLines.push(...vertLines); @@ -39,12 +41,17 @@ export class SnappingManager { public static get IsResizing() { return this.Instance._isResizing; } // prettier-ignore public static get CanEmbed() { return this.Instance._canEmbed; } // prettier-ignore public static get ExploreMode() { return this.Instance._exploreMode; } // prettier-ignore - public static SetShiftKey = (down: boolean) => runInAction(() => (this.Instance._shiftKey = down)); // prettier-ignore - public static SetCtrlKey = (down: boolean) => runInAction(() => (this.Instance._ctrlKey = down)); // prettier-ignore - public static SetMetaKey = (down: boolean) => runInAction(() => (this.Instance._metaKey = down)); // prettier-ignore - public static SetIsLinkFollowing= (follow:boolean)=> runInAction(() => (this.Instance._isLinkFollowing = follow)); // prettier-ignore - public static SetIsDragging = (drag: boolean) => runInAction(() => (this.Instance._isDragging = drag)); // prettier-ignore - public static SetIsResizing = (doc: Opt<Doc>) => runInAction(() => (this.Instance._isResizing = doc)); // prettier-ignore - public static SetCanEmbed = (embed:boolean) => runInAction(() => (this.Instance._canEmbed = embed)); // prettier-ignore - public static SetExploreMode = (state:boolean) => runInAction(() => (this.Instance._exploreMode = state)); // prettier-ignore + public static SetShiftKey = (down: boolean) => runInAction(() => {this.Instance._shiftKey = down}); // prettier-ignore + public static SetCtrlKey = (down: boolean) => runInAction(() => {this.Instance._ctrlKey = down}); // prettier-ignore + public static SetMetaKey = (down: boolean) => runInAction(() => {this.Instance._metaKey = down}); // prettier-ignore + public static SetIsLinkFollowing= (follow:boolean)=> runInAction(() => {this.Instance._isLinkFollowing = follow}); // prettier-ignore + public static SetIsDragging = (drag: boolean) => runInAction(() => {this.Instance._isDragging = drag}); // prettier-ignore + public static SetIsResizing = (docid?:string) => runInAction(() => {this.Instance._isResizing = docid}); // prettier-ignore + public static SetCanEmbed = (embed:boolean) => runInAction(() => {this.Instance._canEmbed = embed}); // prettier-ignore + public static SetExploreMode = (state:boolean) => runInAction(() => {this.Instance._exploreMode = state}); // prettier-ignore + + public static userColor: string | undefined; + public static userVariantColor: string | undefined; + public static userBackgroundColor: string | undefined; + public static SettingsStyle: any; } |