aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkingControl.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-09-13 17:30:02 -0400
committerbob <bcz@cs.brown.edu>2019-09-13 17:30:02 -0400
commitdd7679295b84ceba49b8d581bb64f97cc1a86fbb (patch)
treecaf3ffb20a526fc65f31900dabc1bf90bc132adb /src/client/views/InkingControl.tsx
parent233893698083cbcfcf39ddad8b57049aeb1ba842 (diff)
more rule provider fixes
Diffstat (limited to 'src/client/views/InkingControl.tsx')
-rw-r--r--src/client/views/InkingControl.tsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client/views/InkingControl.tsx b/src/client/views/InkingControl.tsx
index 86d0fc0be..94cc1f06c 100644
--- a/src/client/views/InkingControl.tsx
+++ b/src/client/views/InkingControl.tsx
@@ -51,7 +51,13 @@ export class InkingControl extends React.Component {
let oldColors = selected.map(view => {
let targetDoc = view.props.Document.layout instanceof Doc ? view.props.Document.layout : view.props.Document.isTemplate ? view.props.Document : Doc.GetProto(view.props.Document);
let oldColor = StrCast(targetDoc.backgroundColor);
- if (view.props.ContainingCollectionView && view.props.ContainingCollectionView.props.Document.colorPalette) {
+ if (view.props.ContainingCollectionView) {
+ if (!view.props.ContainingCollectionView.props.Document.colorPalette) {
+ let defaultPalette = ["rg14,229,239)", "rgb(255,246,209)", "rgb(255,188,156)", "rgb(247,220,96)", "rgb(122,176,238)",
+ "rgb(209,150,226)", "rgb(127,235,144)", "rgb(252,188,189)", "rgb(247,175,81)",];
+ let colorPalette = Cast(view.props.ContainingCollectionView.props.Document.colorPalette, listSpec("string"));
+ if (!colorPalette) view.props.ContainingCollectionView.props.Document.colorPalette = new List<string>(defaultPalette);
+ }
let cp = Cast(view.props.ContainingCollectionView.props.Document.colorPalette, listSpec("string")) as string[];
let closest = 0;
let dist = 10000000;