aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/PropertiesView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-21 18:58:21 -0400
committerbobzel <zzzman@gmail.com>2025-03-21 18:58:21 -0400
commit7e4d793eaa7e5b6b564355a11fa02a5611645f20 (patch)
treeacab0bf2057a26b4daeead8ce8d4568afa167b2a /src/client/views/PropertiesView.tsx
parent2d64242ce924a5ba18e3c8dd0a6efe54db2e3f9a (diff)
trying to improve how data / layout / root and templtae docs are accessed.
Diffstat (limited to 'src/client/views/PropertiesView.tsx')
-rw-r--r--src/client/views/PropertiesView.tsx42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index 11adf7435..c72f958fc 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -282,7 +282,7 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
const tags = StrListCast(doc.tags);
if (!tags.includes(value)) {
tags.push(value);
- doc[DocData].tags = tags.length ? new List<string>(tags) : undefined;
+ doc.$tags = tags.length ? new List<string>(tags) : undefined;
}
return true;
}
@@ -498,7 +498,7 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
const individualTableEntries = [];
const usersAdded: string[] = []; // all shared users being added - organized by denormalized email
- const seldoc = this.layoutDocAcls ? this.selectedLayoutDoc : this.selectedDoc?.[DocData];
+ const seldoc = this.layoutDocAcls ? this.selectedLayoutDoc : this.dataDoc;
// adds each user to usersAdded
SharingManager.Instance.users.forEach(eachUser => {
let userOnDoc = true;
@@ -777,7 +777,7 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
switch (field) {
case 'Xps': selDoc.x = NumCast(this.selectedDoc?.x) + (dirs === 'up' ? 10 : -10); break;
case 'Yps': selDoc.y = NumCast(this.selectedDoc?.y) + (dirs === 'up' ? 10 : -10); break;
- case 'stk': selDoc.stroke_width = NumCast(this.selectedDoc?.[DocData].stroke_width) + (dirs === 'up' ? 0.1 : -0.1); break;
+ case 'stk': selDoc.stroke_width = NumCast(this.selectedDoc?.$stroke_width) + (dirs === 'up' ? 0.1 : -0.1); break;
case 'wid': {
const oldWidth = NumCast(selDoc._width);
const oldHeight = NumCast(selDoc._height);
@@ -825,11 +825,11 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
};
getField(key: string) {
- return Field.toString(this.selectedDoc?.[DocData][key] as FieldType);
+ return Field.toString(this.selectedDoc?.['$' + key] as FieldType);
}
@computed get selectedStrokes() {
- return this.containsInkDoc ? DocListCast(this.selectedDoc[DocData].data) : DocumentView.SelectedSchemaDoc() ? [DocumentView.SelectedSchemaDoc()!] : DocumentView.SelectedDocs().filter(doc => doc.layout_isSvg);
+ return this.containsInkDoc ? DocListCast(this.selectedDoc.$data) : DocumentView.SelectedSchemaDoc() ? [DocumentView.SelectedSchemaDoc()!] : DocumentView.SelectedDocs().filter(doc => doc.layout_isSvg);
}
@computed get shapeXps() { return NumCast(this.selectedDoc?.x); } // prettier-ignore
set shapeXps(value) { this.selectedDoc && (this.selectedDoc.x = Math.round(value * 100) / 100); } // prettier-ignore
@@ -839,10 +839,10 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
set shapeWid(value) { this.selectedDoc && (this.selectedDoc._width = Math.round(value * 100) / 100); } // prettier-ignore
@computed get shapeHgt() { return NumCast(this.selectedDoc?._height); } // prettier-ignore
set shapeHgt(value) { this.selectedDoc && (this.selectedDoc._height = Math.round(value * 100) / 100); } // prettier-ignore
- @computed get strokeThk(){ return NumCast(this.selectedStrokes.lastElement()?.[DocData].stroke_width); } // prettier-ignore
+ @computed get strokeThk(){ return NumCast(this.selectedStrokes.lastElement()?.$stroke_width); } // prettier-ignore
set strokeThk(value) {
this.selectedStrokes.forEach(doc => {
- doc[DocData].stroke_width = Math.round(value * 100) / 100;
+ doc.$stroke_width = Math.round(value * 100) / 100;
});
}
@@ -881,20 +881,20 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
private _lastDash: string = '2';
- @computed get colorFil() { return StrCast(this.selectedStrokes.lastElement()?.[DocData].fillColor); } // prettier-ignore
+ @computed get colorFil() { return StrCast(this.selectedStrokes.lastElement()?.$fillColor); } // prettier-ignore
set colorFil(value) {
this.selectedStrokes.forEach(doc => {
const inkStroke = DocumentView.getDocumentView(doc)?.ComponentView as InkingStroke;
const { inkData } = inkStroke.inkScaledData();
if (InkingStroke.IsClosed(inkData)) {
- doc[DocData].fillColor = value || undefined;
+ doc.$fillColor = value || undefined;
}
});
}
- @computed get colorStk() { return StrCast(this.selectedStrokes.lastElement()?.[DocData].color); } // prettier-ignore
+ @computed get colorStk() { return StrCast(this.selectedStrokes.lastElement()?.$olor); } // prettier-ignore
set colorStk(value) {
this.selectedStrokes.forEach(doc => {
- doc[DocData].color = value || undefined;
+ doc.$color = value || undefined;
});
}
@computed get borderColor() {
@@ -902,7 +902,7 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
const layoutDoc = doc ? Doc.Layout(doc) : doc;
return StrCast(layoutDoc.color);
}
- set borderColor(value) { this.selectedDoc && (this.selectedDoc[DocData].color = value || undefined); } // prettier-ignore
+ set borderColor(value) { this.selectedDoc && (this.selectedDoc.$color = value || undefined); } // prettier-ignore
colorButton(value: string, type: string, setter: () => void) {
return (
@@ -1034,41 +1034,41 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
set dashdStk(value) {
value && (this._lastDash = value as string);
this.selectedStrokes.forEach(doc => {
- doc[DocData].stroke_dash = value ? this._lastDash : undefined;
+ doc.$stroke_dash = value ? this._lastDash : undefined;
});
}
@computed get widthStk() { return this.getField('stroke_width') || '1'; } // prettier-ignore
set widthStk(value) {
this.selectedStrokes.forEach(doc => {
- doc[DocData].stroke_width = Number(value);
+ doc.$stroke_width = Number(value);
});
}
@computed get markScal() { return Number(this.getField('stroke_markerScale') || '1'); } // prettier-ignore
set markScal(value) {
this.selectedStrokes.forEach(doc => {
- doc[DocData].stroke_markerScale = Number(value);
+ doc.$stroke_markerScale = Number(value);
});
}
@computed get refStrength() { return Number(this.getField('drawing_refStrength') || '50'); } // prettier-ignore
set refStrength(value) {
- this.selectedDoc[DocData].drawing_refStrength = Number(value);
+ this.selectedDoc.$drawing_refStrength = Number(value);
}
@computed get smoothAmt() { return Number(this.getField('stroke_smoothAmount') || '5'); } // prettier-ignore
set smoothAmt(value) {
this.selectedStrokes.forEach(doc => {
- doc[DocData].stroke_smoothAmount = Number(value);
+ doc.$stroke_smoothAmount = Number(value);
});
}
@computed get markHead() { return this.getField('stroke_startMarker') || ''; } // prettier-ignore
set markHead(value) {
this.selectedStrokes.forEach(doc => {
- doc[DocData].stroke_startMarker = value;
+ doc.$stroke_startMarker = value;
});
}
@computed get markTail() { return this.getField('stroke_endMarker') || ''; } // prettier-ignore
set markTail(value) {
this.selectedStrokes.forEach(doc => {
- doc[DocData].stroke_endMarker = value;
+ doc.$stroke_endMarker = value;
});
}
@@ -1356,7 +1356,7 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
* of ink strokes in the properties menu.
*/
containsInk = (selectedDoc: Doc) => {
- const childDocs: Doc[] = DocListCast(selectedDoc[DocData].data);
+ const childDocs: Doc[] = DocListCast(selectedDoc.$data);
for (let i = 0; i < childDocs.length; i++) {
if (DocumentView.getDocumentView(childDocs[i])?.layoutDoc?.layout_isSvg) {
return true;
@@ -1454,7 +1454,7 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
@undoBatch
setDescripValue = action((value: string) => {
if (this.selectedLink) {
- this.selectedLink[DocData].link_description = value;
+ this.selectedLink.$link_description = value;
}
});