aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/StyleProvider.tsx
diff options
context:
space:
mode:
authorSophie Zhang <sophie_zhang@brown.edu>2023-03-06 16:33:39 -0500
committerSophie Zhang <sophie_zhang@brown.edu>2023-03-06 16:33:39 -0500
commit3a6f179aedf8e148fe9828426b43aa31ca87bcb1 (patch)
tree9f49ba8d54bda361826c17cfe7f3cb0a37854ace /src/client/views/StyleProvider.tsx
parentc6425a0469727305f76d00e3f8c545e04aad61cc (diff)
parent4c2584baf8bae0cde714c832b0768d3c08864422 (diff)
Merge branch 'master' into pres-trail-sophie
Diffstat (limited to 'src/client/views/StyleProvider.tsx')
-rw-r--r--src/client/views/StyleProvider.tsx15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx
index ece224c68..153c30052 100644
--- a/src/client/views/StyleProvider.tsx
+++ b/src/client/views/StyleProvider.tsx
@@ -19,6 +19,7 @@ import { SliderBox } from './nodes/SliderBox';
import './StyleProvider.scss';
import React = require('react');
import { Shadows } from 'browndash-components';
+import { SelectionManager } from '../util/SelectionManager';
export enum StyleProp {
TreeViewIcon = 'treeViewIcon',
@@ -30,6 +31,7 @@ export enum StyleProp {
BorderRounding = 'borderRounding', // border radius of the document view
Color = 'color', // foreground color of Document view items
BackgroundColor = 'backgroundColor', // background color of a document view
+ FillColor = 'fillColor', // fill color of an ink stroke or shape
WidgetColor = 'widgetColor', // color to display UI widgets on a document view -- used for the sidebar divider dragger on a text note
HideLinkButton = 'hideLinkButton', // hides the blue-dot link button. used when a document acts like a button
LinkSource = 'linkSource', // source document of a link -- used by LinkAnchorBox
@@ -116,7 +118,12 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<DocumentViewProps
const excludeTypes = [DocumentType.FONTICON];
let highlighting = !props?.disableDocBrushing && highlightIndex && !excludeTypes.includes(doc.type as any) && doc._viewType !== CollectionViewType.Linear; // bcz: hack to turn off highlighting onsidebar panel documents. need to flag a document as not highlightable in a more direct way
if (highlighting && props?.focus !== emptyFunction && StrCast(doc.title) !== '[pres element template]') {
- return { highlightStyle, highlightColor, highlightIndex, highlightStroke: doc.type === DocumentType.INK };
+ return {
+ highlightStyle,
+ highlightColor: highlightIndex !== Doc.DocBrushStatus.highlighted && SelectionManager.Views().some(dv => dv.rootDoc === doc) ? 'black' : highlightColor,
+ highlightIndex,
+ highlightStroke: doc.type === DocumentType.INK,
+ };
}
}
return undefined;
@@ -152,6 +159,8 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<DocumentViewProps
)) ||
''
);
+ case StyleProp.FillColor:
+ return Cast(doc?._fillColor, 'string', Cast(doc?.fillColor, 'string', 'transparent'));
case StyleProp.Color:
if (MainView.Instance.LastButton === doc) return Colors.DARK_GRAY;
const docColor: Opt<string> = StrCast(doc?.[fieldKey + 'color'], StrCast(doc?._color));
@@ -269,9 +278,9 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<DocumentViewProps
default:
return doc.z
? `#9c9396 ${StrCast(doc?.boxShadow, '10px 10px 0.9vw')}` // if it's a floating doc, give it a big shadow
- : props?.ContainingCollectionDoc?._useClusters && doc.type !== DocumentType.INK
+ : props?.ContainingCollectionDoc?._useClusters
? `${backgroundCol()} ${StrCast(doc.boxShadow, `0vw 0vw ${(isBackground() ? 100 : 50) / (docProps?.NativeDimScaling?.() || 1)}px`)}` // if it's just in a cluster, make the shadown roughly match the cluster border extent
- : NumCast(doc.group, -1) !== -1 && doc.type !== DocumentType.INK
+ : NumCast(doc.group, -1) !== -1
? `gray ${StrCast(doc.boxShadow, `0vw 0vw ${(isBackground() ? 100 : 50) / (docProps?.NativeDimScaling?.() || 1)}px`)}` // if it's just in a cluster, make the shadown roughly match the cluster border extent
: isBackground()
? undefined // if it's a background & has a cluster color, make the shadow spread really big