From 93703f4c02c4c6e68489aca72bc0460efc3f6f5e Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 4 Jan 2021 13:16:13 -0500 Subject: Fixed filterbox to use scriptContext to determine where to apply/clear filters .fixed setting width/height of freeform images independent of nativeWidth/height so that % css measurements work. --- src/client/views/nodes/CollectionFreeFormDocumentView.tsx | 2 ++ src/client/views/nodes/DocumentView.tsx | 4 ++-- src/client/views/nodes/FilterBox.tsx | 1 + src/client/views/nodes/SliderBox-components.tsx | 3 +-- src/client/views/nodes/SliderBox.scss | 12 +++++++++++- src/client/views/nodes/SliderBox.tsx | 7 +++++-- 6 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx index bfb6e8fc8..09d89170c 100644 --- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx +++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx @@ -169,6 +169,8 @@ export class CollectionFreeFormDocumentView extends DocComponent - cm.addItem({ description: label, event: () => customScripts[i]?.script.run({ this: this.layoutDoc, self: this.rootDoc }), icon: "sticky-note" })); + cm.addItem({ description: label, event: () => customScripts[i]?.script.run({ this: this.layoutDoc, scriptContext: this.props.scriptContext, self: this.rootDoc }), icon: "sticky-note" })); this.props.contextMenuItems?.().forEach(item => - item.label && cm.addItem({ description: item.label, event: () => item.script.script.run({ this: this.layoutDoc, self: this.rootDoc }), icon: "sticky-note" })); + item.label && cm.addItem({ description: item.label, event: () => item.script.script.run({ this: this.layoutDoc, scriptContext: this.props.scriptContext, self: this.rootDoc }), icon: "sticky-note" })); const templateDoc = Cast(this.props.Document[StrCast(this.props.Document.layoutKey)], Doc, null); const appearance = cm.findByDescription("UI Controls..."); diff --git a/src/client/views/nodes/FilterBox.tsx b/src/client/views/nodes/FilterBox.tsx index 36df21b2d..badacbc5c 100644 --- a/src/client/views/nodes/FilterBox.tsx +++ b/src/client/views/nodes/FilterBox.tsx @@ -210,6 +210,7 @@ export class FilterBox extends ViewBoxBaseComponent diff --git a/src/client/views/nodes/SliderBox-components.tsx b/src/client/views/nodes/SliderBox-components.tsx index 874a1108f..e19f28f08 100644 --- a/src/client/views/nodes/SliderBox-components.tsx +++ b/src/client/views/nodes/SliderBox-components.tsx @@ -11,7 +11,6 @@ const railStyle: React.CSSProperties = { position: "absolute", width: "100%", height: 40, - top: -13, borderRadius: 7, cursor: "pointer", opacity: 0.3, @@ -231,7 +230,7 @@ export function Tick({ tick, count, format = defaultFormat }: TickProps) {
runInAction(() => { this.dataDoc[this.minThumbKey] = values[0]; this.dataDoc[this.maxThumbKey] = values[1]; - Cast(this.layoutDoc.onThumbChanged, ScriptField, null)?.script.run({ self: this.rootDoc, range: values, this: this.layoutDoc }); + Cast(this.layoutDoc.onThumbChanged, ScriptField, null)?.script.run({ + self: this.rootDoc, + scriptContext: this.props.scriptContext, range: values, this: this.layoutDoc + }); }) render() { @@ -103,7 +106,7 @@ export class SliderBox extends ViewBoxBaseComponent {({ ticks }) => ( -
+
{ticks.map((tick) => (