aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentDecorations.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-11-29 10:02:34 -0500
committerbobzel <zzzman@gmail.com>2023-11-29 10:02:34 -0500
commitba3b3f6f261074bd3f35012bde8730f5d4a36905 (patch)
tree6f6c7b141f8bc5881113378801d4b2940cfde36a /src/client/views/DocumentDecorations.tsx
parentac360607bee82f0fef769eada99dc0b3f85ae70a (diff)
numerous changes to fix bugs and to fix/remove old or hacky code. fixed doc dec resizing. moving this.rootDoc => this.Document . fixing template artifacts.
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
-rw-r--r--src/client/views/DocumentDecorations.tsx18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index d4b474de9..4ede2e2bb 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
import { FaUndo } from 'react-icons/fa';
import { DateField } from '../../fields/DateField';
import { Doc, DocListCast, Field, HierarchyMapping, ReverseHierarchyMap } from '../../fields/Doc';
-import { AclAdmin, AclAugment, AclEdit, DocData } from '../../fields/DocSymbols';
+import { AclAdmin, AclAugment, AclEdit } from '../../fields/DocSymbols';
import { InkField } from '../../fields/InkField';
import { RichTextField } from '../../fields/RichTextField';
import { ScriptField } from '../../fields/ScriptField';
@@ -71,10 +71,8 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
e.clientY - center.y,
NumCast(SelectionManager.Views().lastElement()?.screenToLocalTransform().Rotate));
(this._showNothing = !(this.Bounds.x !== Number.MAX_VALUE && //
- (this.Bounds.x > center.x+x + this._resizeBorderWidth / 2 ||
- this.Bounds.r < center.x+x - this._resizeBorderWidth / 2 ||
- this.Bounds.y > center.y+y + this._resizeBorderWidth / 2 ||
- this.Bounds.b < center.y+y - this._resizeBorderWidth / 2)));
+ (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
}
@@ -551,8 +549,8 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
if (setData) Doc.SetNativeHeight(Doc.GetProto(doc), NumCast(doc._nativeHeight));
}
- doc._width = NumCast(doc._width) * scale.x;
- doc._height = NumCast(doc._height) * scale.y;
+ doc._width = Math.max(1, NumCast(doc._width) * scale.x);
+ doc._height = Math.max(1, NumCast(doc._height) * scale.y);
const { deltaX, deltaY } = this.realignRefPt(doc, refCent, initWidth, initHeight);
doc.x = NumCast(doc.x) + deltaX;
doc.y = NumCast(doc.y) + deltaY;
@@ -675,7 +673,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
seldocview.props.hideDeleteButton ||
seldocview.rootDoc.hideDeleteButton ||
SelectionManager.Views().some(docView => {
- const collectionAcl = docView.props.docViewPath()?.lastElement() ? GetEffectiveAcl(docView.props.docViewPath().lastElement().rootDoc[DocData]) : AclEdit;
+ const collectionAcl = docView.props.docViewPath()?.lastElement() ? GetEffectiveAcl(docView.props.docViewPath().lastElement().dataDoc) : AclEdit;
return collectionAcl !== AclAdmin && collectionAcl !== AclEdit && GetEffectiveAcl(docView.rootDoc) !== AclAdmin;
});
const topBtn = (key: string, icon: string, pointerDown: undefined | ((e: React.PointerEvent) => void), click: undefined | ((e: any) => void), title: string) => (
@@ -801,11 +799,9 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
<div key="bl" className="documentDecorations-bottomLeftResizer" onPointerDown={this.onPointerDown} />
<div key="b" className="documentDecorations-bottomResizer" onPointerDown={this.onPointerDown} />
<div key="br" className="documentDecorations-bottomRightResizer" onPointerDown={this.onPointerDown} />
- {seldocview.props.renderDepth <= 1 || !seldocview.props.docViewPath().lastElement()
- ? null
- : topBtn('selector', 'arrow-alt-circle-up', undefined, this.onSelectContainerDocClick, 'tap to select containing document')}
</>
)}
+ {seldocview.props.renderDepth <= 1 || !seldocview.props.docViewPath().lastElement() ? null : topBtn('selector', 'arrow-alt-circle-up', undefined, this.onSelectContainerDocClick, 'tap to select containing document')}
{useRounding && (
<div
className="documentDecorations-borderRadius"