diff options
author | bobzel <zzzman@gmail.com> | 2022-04-04 11:39:17 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-04-04 11:39:17 -0400 |
commit | 1ca9e485ea99db7db35fe52b0e15d6defa7568d3 (patch) | |
tree | 76afa097726e2eb8761ec3e7d811c9d72e4c6d89 /src/fields/Doc.ts | |
parent | 69625f2e9ecbffaa343af16eebe04c9b555fdf23 (diff) |
cleaned up warnings. fixed ink to work better with it's label boxes by not letting textbox ComponentView override inkinstroke. made ink text boxes go away unless they have text or are selected. fixed up brushing code and made it work for ink and ink w/ text labels
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index c932259de..1edab16be 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -935,7 +935,7 @@ export namespace Doc { } export function isBrushedHighlightedDegree(doc: Doc) { - return Doc.IsHighlighted(doc) ? 6 : Doc.IsBrushedDegree(doc); + return Doc.IsHighlighted(doc) ? DocBrushStatus.highlighted : Doc.IsBrushedDegree(doc); } export class DocBrush { @@ -1009,10 +1009,16 @@ export namespace Doc { const isBrushedCache = computedFn(function IsBrushed(doc: Doc) { return brushManager.BrushedDoc.has(doc) || brushManager.BrushedDoc.has(Doc.GetProto(doc)); }); export function IsBrushed(doc: Doc) { return isBrushedCache(doc); } + export enum DocBrushStatus { + unbrushed = 0, + protoBrushed = 1, + selfBrushed = 2, + highlighted = 3 + } // don't bother memoizing (caching) the result if called from a non-reactive context. (plus this avoids a warning message) export function IsBrushedDegreeUnmemoized(doc: Doc) { - if (!doc || GetEffectiveAcl(doc) === AclPrivate || GetEffectiveAcl(Doc.GetProto(doc)) === AclPrivate) return 0; - return brushManager.BrushedDoc.has(doc) ? 2 : brushManager.BrushedDoc.has(Doc.GetProto(doc)) ? 1 : 0; + if (!doc || GetEffectiveAcl(doc) === AclPrivate || GetEffectiveAcl(Doc.GetProto(doc)) === AclPrivate) return DocBrushStatus.unbrushed; + return brushManager.BrushedDoc.has(doc) ? DocBrushStatus.selfBrushed : brushManager.BrushedDoc.has(Doc.GetProto(doc)) ? DocBrushStatus.protoBrushed : DocBrushStatus.unbrushed; } export function IsBrushedDegree(doc: Doc) { return computedFn(function IsBrushDegree(doc: Doc) { |