aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentDecorations.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-01-23 16:11:42 -0500
committerbobzel <zzzman@gmail.com>2024-01-23 16:11:42 -0500
commitaf380979349308077e13fc12a2d09255b7f05f28 (patch)
tree79585221a23bccf2d352095b26bea99981ca92dc /src/client/views/DocumentDecorations.tsx
parent001127c07f95173d7036db19d07dcfb1135f3caa (diff)
reorganization of DocumentView, DocumentViewInternal and FieldView methods and props. fix for selection bug after following a link. migrating to use [DocData] instad of GetProto()
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
-rw-r--r--src/client/views/DocumentDecorations.tsx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 8db972ef0..5ef62b2c5 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -8,7 +8,7 @@ import { FaUndo } from 'react-icons/fa';
import { Utils, emptyFunction, lightOrDark, numberValue, returnFalse, setupMoveUpEvents } from '../../Utils';
import { DateField } from '../../fields/DateField';
import { Doc, DocListCast, Field, HierarchyMapping, ReverseHierarchyMap } from '../../fields/Doc';
-import { AclAdmin, AclAugment, AclEdit } from '../../fields/DocSymbols';
+import { AclAdmin, AclAugment, AclEdit, DocData } from '../../fields/DocSymbols';
import { InkField } from '../../fields/InkField';
import { RichTextField } from '../../fields/RichTextField';
import { ScriptField } from '../../fields/ScriptField';
@@ -101,7 +101,7 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
{ x: 0, y: 0, r: 0, b: 0 }
: SelectionManager.Views
.filter(dv => dv._props.renderDepth > 0)
- .map(dv => dv.getBounds())
+ .map(dv => dv.getBounds)
.reduce((bounds, rect) => !rect ? bounds
: { x: Math.min(rect.left, bounds.x),
y: Math.min(rect.top, bounds.y),
@@ -203,7 +203,7 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
const containers = new Set<Doc | undefined>();
SelectionManager.Views.forEach(v => containers.add(DocCast(v.Document.embedContainer)));
if (containers.size > 1) return false;
- const { left, top } = dragDocView.getBounds() || { left: 0, top: 0 };
+ const { left, top } = dragDocView.getBounds || { left: 0, top: 0 };
const dragData = new DragManager.DocumentDragData(
SelectionManager.Views.map(dv => dv.Document),
dragDocView._props.dropAction
@@ -541,17 +541,17 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
}
if (['right', 'left'].includes(opts.dragHdl) && modifyNativeDim && Doc.NativeWidth(doc)) {
- const setData = Doc.NativeWidth(Doc.GetProto(doc)) === doc.nativeWidth;
+ const setData = Doc.NativeWidth(doc[DocData]) === doc.nativeWidth;
doc.nativeWidth = scale.x * Doc.NativeWidth(doc);
- if (setData) Doc.SetNativeWidth(Doc.GetProto(doc), NumCast(doc.nativeWidth));
+ if (setData) Doc.SetNativeWidth(doc[DocData], NumCast(doc.nativeWidth));
if (doc.layout_reflowVertical && !NumCast(doc.nativeHeight)) {
doc._nativeHeight = (initHeight / initWidth) * nwidth; // initializes the nativeHeight for a PDF
}
}
if (['bottom', 'top'].includes(opts.dragHdl) && modifyNativeDim && Doc.NativeHeight(doc)) {
- const setData = Doc.NativeHeight(Doc.GetProto(doc)) === doc.nativeHeight;
+ const setData = Doc.NativeHeight(doc[DocData]) === doc.nativeHeight;
doc._nativeHeight = scale.y * Doc.NativeHeight(doc);
- if (setData) Doc.SetNativeHeight(Doc.GetProto(doc), NumCast(doc._nativeHeight));
+ if (setData) Doc.SetNativeHeight(doc[DocData], NumCast(doc._nativeHeight));
}
doc._width = Math.max(1, NumCast(doc._width) * scale.x);
@@ -601,7 +601,7 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
this._inkDragDocs
.map(oldbds => ({ oldbds, inkPts: Cast(oldbds.doc.data, InkField)?.inkData || [] }))
.forEach(({ oldbds: { doc, x, y, width, height }, inkPts }) => {
- Doc.GetProto(doc).data = new InkField(inkPts.map(
+ doc[DocData].data = new InkField(inkPts.map(
(ipt) => ({// (new x — oldx) + newWidth * (oldxpoint /oldWidth)
X: NumCast(doc.x) - x + (NumCast(doc.width) * ipt.X) / width,
Y: NumCast(doc.y) - y + (NumCast(doc.height) * ipt.Y) / height,