aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/TreeView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-12-10 21:41:54 -0500
committerbobzel <zzzman@gmail.com>2020-12-10 21:41:54 -0500
commit896db53261aca91de21eabfaa6fed0c1b27e3e51 (patch)
tree8b8380c3fd30065a98054714d3d4d2535da81f8a /src/client/views/collections/TreeView.tsx
parentdcf5ba2699d7f83f604bedeadea3ba69061a0fd1 (diff)
moved opacity and borderRounding into styleProviders. fixed contextMenu clcik from button bar
Diffstat (limited to 'src/client/views/collections/TreeView.tsx')
-rw-r--r--src/client/views/collections/TreeView.tsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx
index be8a27ab0..24dd905a9 100644
--- a/src/client/views/collections/TreeView.tsx
+++ b/src/client/views/collections/TreeView.tsx
@@ -441,7 +441,7 @@ export class TreeView extends React.Component<TreeViewProps> {
return <div className={`bullet${this.outlineMode ? "-outline" : ""}`} key={"bullet"}
title={this.childDocs?.length ? `click to see ${this.childDocs?.length} items` : "view fields"}
onClick={this.bulletClick}
- style={this.outlineMode ? { opacity: NumCast(this.doc.opacity, 1) } : {
+ style={this.outlineMode ? { opacity: this.styleProvider?.(this.doc, this.props.treeView.props, "opacity") } : {
color: StrCast(this.doc.color, checked === "unchecked" ? "white" : "inherit"),
opacity: checked === "unchecked" ? undefined : 0.4
}}>
@@ -496,6 +496,12 @@ export class TreeView extends React.Component<TreeViewProps> {
e.preventDefault();
}
}
+ styleProvider = (doc: (Doc | undefined), props: DocumentViewProps, property: string): any => {
+ // override opacity and backgroundColor just for this treeView document: opacity = 1, and backgroundColor = undefined unless it is explicitly set on the document
+ if (property === "opacity" && doc === this.props.document) return this.outlineMode ? undefined : 1;
+ if (property === "backgroundColor" && doc === this.props.document) return StrCast(doc._backgroundColor, StrCast(doc.backgroundColor));
+ return this.props.treeView.props.styleProvider?.(doc, props, property);
+ }
onKeyDown = (e: React.KeyboardEvent) => {
if (this.doc.treeViewHideHeader || this.outlineMode) {
e.stopPropagation();
@@ -520,6 +526,7 @@ export class TreeView extends React.Component<TreeViewProps> {
ref={this._docRef}
Document={this.doc}
DataDoc={undefined}
+ styleProvider={this.styleProvider}
treeViewDoc={this.props.treeView.props.Document}
addDocument={undefined}
addDocTab={this.props.addDocTab}
@@ -535,7 +542,6 @@ export class TreeView extends React.Component<TreeViewProps> {
PanelWidth={this.truncateTitleWidth}
PanelHeight={returnZero}
contextMenuItems={this.contextMenuItems}
- opacity={this.outlineMode ? undefined : returnOne}
renderDepth={1}
focus={returnTrue}
parentActive={returnTrue}