From ad1b41beaa0c55487d41381bddd80ab1a76e7fb5 Mon Sep 17 00:00:00 2001 From: bobzel Date: Sat, 30 Mar 2024 00:36:19 -0400 Subject: added Labels button for turning ink labels on/off. added Pixels and Rotate buttons for images. enabled ink as template for text : check for ink stroke data on layout doc if it's not on data doc & started to have style provider check for properties on layout doc instead of data (background color, boxShadow). fixed toggling key/value on and off when node is selected. --- src/client/views/nodes/DocumentView.scss | 1 - 1 file changed, 1 deletion(-) (limited to 'src/client/views/nodes/DocumentView.scss') diff --git a/src/client/views/nodes/DocumentView.scss b/src/client/views/nodes/DocumentView.scss index 5421c1b50..4fea6b3c6 100644 --- a/src/client/views/nodes/DocumentView.scss +++ b/src/client/views/nodes/DocumentView.scss @@ -256,6 +256,5 @@ .documentView-node:first-child { position: relative; - background: '#B59B66'; //$white; } } -- cgit v1.2.3-70-g09d2 From 47ae05389d7ce564efde19b7a639b38842759cc1 Mon Sep 17 00:00:00 2001 From: bobzel Date: Sun, 31 Mar 2024 00:09:33 -0400 Subject: fixed dropdown in title bar location. moved rotate button up to not interfere with button bar. don't blur title when editing it. fix drawgging rotate center on templates. support setting alternate colors for text docs -- pretty hacky. fixed tabbing through dashFieldViews. --- src/client/views/DocumentDecorations.scss | 2 +- src/client/views/DocumentDecorations.tsx | 21 +++++++++++++++------ src/client/views/StyleProvider.tsx | 5 ++++- .../collectionFreeForm/CollectionFreeFormView.tsx | 2 +- src/client/views/global/globalScripts.ts | 4 +++- src/client/views/nodes/DocumentView.scss | 6 ++++++ src/client/views/nodes/DocumentView.tsx | 6 +++++- .../views/nodes/formattedText/DashFieldView.tsx | 17 ++++++++++------- .../views/nodes/formattedText/FormattedTextBox.tsx | 7 +++++-- 9 files changed, 50 insertions(+), 20 deletions(-) (limited to 'src/client/views/nodes/DocumentView.scss') diff --git a/src/client/views/DocumentDecorations.scss b/src/client/views/DocumentDecorations.scss index ac0ef054c..239c0a977 100644 --- a/src/client/views/DocumentDecorations.scss +++ b/src/client/views/DocumentDecorations.scss @@ -14,7 +14,7 @@ $resizeHandler: 8px; height: 30; width: 30; right: -40; - bottom: -40; + bottom: -20; //top: calc(50% - 15px); position: absolute; pointer-events: all; diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 6698cd5bc..951e0912c 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -73,11 +73,18 @@ export class DocumentDecorations extends ObservableReactComponent { + let inputting = false; + if (this._titleControlString.startsWith('$')) { + const titleFieldKey = this._titleControlString.substring(1); + if (SelectionManager.Views[0]?.Document[titleFieldKey] !== this._accumulatedTitle) { + inputting = true; + } + } const center = {x: (this.Bounds.x+this.Bounds.r)/2, y: (this.Bounds.y+this.Bounds.b)/2}; const {x,y} = Utils.rotPt(e.clientX - center.x, e.clientY - center.y, NumCast(SelectionManager.Views.lastElement()?.screenToViewTransform().Rotate)); - (this._showNothing = !DocumentButtonBar.Instance?._tooltipOpen && !(this.Bounds.x !== Number.MAX_VALUE && // + (this._showNothing = !inputting && !DocumentButtonBar.Instance?._tooltipOpen && !(this.Bounds.x !== Number.MAX_VALUE && // (this.Bounds.x > center.x+x || this.Bounds.r < center.x+x || this.Bounds.y > center.y+y || this.Bounds.b < center.y+y ))); })); // prettier-ignore @@ -336,8 +343,8 @@ export class DocumentDecorations extends ObservableReactComponent // return false to keep getting events this.setRotateCenter(seldocview, [this.rotCenter[0] + delta[0], this.rotCenter[1] + delta[1]]) as any as boolean, action(e => (this._isRotating = false)), // upEvent - action(e => (seldocview.Document.rotation_centerX = seldocview.Document.rotation_centerY = 0)) + action(e => (seldocview.Document._rotation_centerX = seldocview.Document._rotation_centerY = 0)), + true ); // prettier-ignore + e.stopPropagation(); }; @action @@ -617,7 +626,7 @@ export class DocumentDecorations extends ObservableReactComponent { this._editingTitle = false; - !hideTitle && this.titleBlur(); + this.titleBlur(); })} onChange={action(e => !hideTitle && (this._accumulatedTitle = e.target.value))} onKeyDown={hideTitle ? emptyFunction : this.titleEntered} diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx index 749198fe6..dcec2fe3d 100644 --- a/src/client/views/StyleProvider.tsx +++ b/src/client/views/StyleProvider.tsx @@ -200,7 +200,10 @@ export function DefaultStyleProvider(doc: Opt, props: Opt = StrCast(doc?.[fieldKey + 'backgroundColor'], StrCast(doc?.backgroundColor, isCaption ? 'rgba(0,0,0,0.4)' : '')); + const dataKey = doc ? Doc.LayoutFieldKey(doc) : ""; + const usePath = StrCast(doc?.[dataKey + "_usePath"]); + const alternate = usePath.includes(":hover") ? ( doc?.isHovering ? '_' + usePath.replace(":hover","") : "") : usePath ? "_" +usePath:usePath; + let docColor: Opt = StrCast(doc?.[fieldKey+alternate], StrCast(doc?.['backgroundColor' +alternate], isCaption ? 'rgba(0,0,0,0.4)' : '')); if (doc?.[StrCast(doc?.layout_fieldKey)] instanceof Doc) docColor = StrCast(doc._backgroundColor,docColor) // prettier-ignore switch (layoutDoc?.type) { diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index d435173f3..791124f50 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1288,7 +1288,7 @@ export class CollectionFreeFormView extends CollectionSubView div { + transform-origin: top left !important; + } +} + .contentFittingDocumentView { position: relative; display: flex; diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index a04030a5f..fc2da18d9 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -843,7 +843,11 @@ export class DocumentViewInternal extends DocComponent - {!dropdownWidth ? null :
{this.fieldsDropdown(showTitle)}
} + {!dropdownWidth ? null : ( +
+ {this.fieldsDropdown(showTitle)} +
+ )}
this._nodeSelected; @@ -38,6 +39,7 @@ export class DashFieldView { const self = this; this.node = node; this.tbox = tbox; + this.getpos = getPos; this.dom = document.createElement('div'); this.dom.style.width = node.attrs.width; this.dom.style.height = node.attrs.height; @@ -54,13 +56,13 @@ export class DashFieldView { const editor = tbox.EditorView; if (editor) { const state = editor.state; - for (var i = state.selection.to; i < state.doc.content.size; i++) { + for (var i = self.getpos() + 1; i < state.doc.content.size; i++) { if (state.doc.nodeAt(i)?.type.name === state.schema.nodes.dashField.name) { editor.dispatch(state.tr.setSelection(new NodeSelection(state.doc.resolve(i)))); return; } } - tBox.setFocus(state.selection.to); + // tBox.setFocus(state.selection.to); } } }; @@ -137,7 +139,7 @@ export class DashFieldViewInternal extends ObservableReactComponent (this._dashDoc = this._props.dataDoc ? doc[DocData] : doc); + const setDoc = action((doc: Doc) => (this._dashDoc = this._props.dataDoc ? doc[DocData] : doc)); if (this._props.docId) { DocServer.GetRefField(this._props.docId).then(dashDoc => dashDoc instanceof Doc && setDoc(dashDoc)); @@ -255,7 +257,7 @@ export class DashFieldViewInternal extends ObservableReactComponent | undefined) => { - event && this._dashDoc && (this._dashDoc[this._fieldKey] = event.target.value); + event && this._dashDoc && (this._dashDoc[this._fieldKey] = event.target.value === '-unset-' ? undefined : event.target.value); }; @computed get values() { @@ -281,13 +283,14 @@ export class DashFieldViewInternal extends ObservableReactComponent )} {this._props.fieldKey.startsWith('#') || this._hideValue ? null : this.fieldValueContent} - {/* {!this.values.length ? null : ( - + {this.values.map(val => ( ))} - )} */} + )}
); } diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index 66df1eaf2..3700b08d6 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -2064,8 +2064,11 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent (this._isHovering = true))} - onPointerLeave={action(() => (this._isHovering = false))} + onPointerEnter={action(() => { + this._isHovering = true; + this.layoutDoc[`_${this._props.fieldKey}_usePath`] && (this.Document.isHovering = true); + })} + onPointerLeave={action(() => (this.Document.isHovering = this._isHovering = false))} ref={r => { this._oldWheel?.removeEventListener('wheel', this.onPassiveWheel); this._oldWheel = r; -- cgit v1.2.3-70-g09d2