aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ImageBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-24 21:16:23 -0400
committerbobzel <zzzman@gmail.com>2025-03-24 21:16:23 -0400
commitb033279d56ad82829d1d342b43a0eb342a8c26fe (patch)
tree03e24afc3512ec1942930c388b6127b4802e009c /src/client/views/nodes/ImageBox.tsx
parent0ad3623b42b6d3da170823217050fa18a32a52f4 (diff)
cleanup
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
-rw-r--r--src/client/views/nodes/ImageBox.tsx19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx
index a8985a2b7..c737623f5 100644
--- a/src/client/views/nodes/ImageBox.tsx
+++ b/src/client/views/nodes/ImageBox.tsx
@@ -146,11 +146,10 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
},
{ fireImmediately: true, delay: 1000 }
);
- const { layoutDoc } = this;
this._disposers.path = reaction(
() => ({ nativeSize: this.nativeSize, width: NumCast(this.layoutDoc._width), height: this.layoutDoc._height }),
({ nativeSize, width, height }) => {
- if ((layoutDoc === this.layoutDoc && !this.layoutDoc._layout_nativeDimEditable) || !height) {
+ if (!this.layoutDoc._layout_nativeDimEditable || !height) {
this.layoutDoc._height = (width * nativeSize.nativeHeight) / nativeSize.nativeWidth;
}
},
@@ -252,12 +251,12 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
const nw = nscale / oldnativeWidth;
this.dataDoc[this.fieldKey + '_nativeHeight'] = NumCast(this.dataDoc[this.fieldKey + '_nativeHeight']) * nw;
this.dataDoc[this.fieldKey + '_nativeWidth'] = NumCast(this.dataDoc[this.fieldKey + '_nativeWidth']) * nw;
- this.dataDoc._freeform_panX = nw * NumCast(this.dataDoc._freeform_panX);
- this.dataDoc._freeform_panY = nw * NumCast(this.dataDoc._freeform_panY);
- this.dataDoc._freeform_panX_max = this.dataDoc._freeform_panX_max ? nw * NumCast(this.dataDoc._freeform_panX_max) : undefined;
- this.dataDoc._freeform_panX_min = this.dataDoc._freeform_panX_min ? nw * NumCast(this.dataDoc._freeform_panX_min) : undefined;
- this.dataDoc._freeform_panY_max = this.dataDoc._freeform_panY_max ? nw * NumCast(this.dataDoc._freeform_panY_max) : undefined;
- this.dataDoc._freeform_panY_min = this.dataDoc._freeform_panY_min ? nw * NumCast(this.dataDoc._freeform_panY_min) : undefined;
+ this.dataDoc.freeform_panX = nw * NumCast(this.dataDoc.freeform_panX);
+ this.dataDoc.freeform_panY = nw * NumCast(this.dataDoc.freeform_panY);
+ this.dataDoc.freeform_panX_max = this.dataDoc.freeform_panX_max ? nw * NumCast(this.dataDoc.freeform_panX_max) : undefined;
+ this.dataDoc.freeform_panX_min = this.dataDoc.freeform_panX_min ? nw * NumCast(this.dataDoc.freeform_panX_min) : undefined;
+ this.dataDoc.freeform_panY_max = this.dataDoc.freeform_panY_max ? nw * NumCast(this.dataDoc.freeform_panY_max) : undefined;
+ this.dataDoc.freeform_panY_min = this.dataDoc.freeform_panY_min ? nw * NumCast(this.dataDoc.freeform_panY_min) : undefined;
const newnativeWidth = NumCast(this.dataDoc[this.fieldKey + '_nativeWidth']);
DocListCast(this.dataDoc[this.annotationKey]).forEach(doc => {
doc.x = (NumCast(doc.x) / oldnativeWidth) * newnativeWidth;
@@ -293,12 +292,12 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
const anchw = NumCast(cropping._width);
const anchh = NumCast(cropping._height);
const viewScale = NumCast(this.dataDoc[this.fieldKey + '_nativeHeight']) / anchh;
- cropping.title = 'crop: ' + this.Document.title;
cropping.x = NumCast(this.Document.x) + NumCast(this.layoutDoc._width);
cropping.y = NumCast(this.Document.y);
+ cropping.onClick = undefined;
cropping._width = anchw * (this._props.NativeDimScaling?.() || 1);
cropping._height = anchh * (this._props.NativeDimScaling?.() || 1);
- cropping.onClick = undefined;
+ cropping.$title = 'crop: ' + this.Document.title;
cropping.$annotationOn = undefined;
cropping.$isDataDoc = true;
cropping.$backgroundColor = undefined;