aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-02-27 15:49:26 -0500
committerbobzel <zzzman@gmail.com>2023-02-27 15:49:26 -0500
commitcfef23fbe4f3c3fee33a6b6cc5e970fe13c7d7b6 (patch)
tree266f9d73acc0f992ab1a122c710fde4313c31740 /src
parentaf2a2c83868c87812e9ae54c8e3cced81374619a (diff)
fixed ink anchor restoration by saving width/height with dataview
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/trails/PresBox.tsx12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx
index 45d386436..486c941e9 100644
--- a/src/client/views/nodes/trails/PresBox.tsx
+++ b/src/client/views/nodes/trails/PresBox.tsx
@@ -344,7 +344,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
@action
static restoreTargetDocView(bestTargetView: Opt<DocumentView>, activeItem: Doc, transTime: number, pinDocLayout: boolean = BoolCast(activeItem.presPinLayout), pinDataTypes?: pinDataTypes, targetDoc?: Doc) {
const bestTarget = bestTargetView?.rootDoc ?? (targetDoc?.unrendered ? DocCast(targetDoc?.annotationOn) : targetDoc);
- if (!bestTarget) return;
+ if (!bestTarget || activeItem === bestTarget) return;
let changed = false;
if (pinDocLayout) {
if (
@@ -385,6 +385,14 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
Doc.GetProto(bestTarget).color = activeItem.color;
changed = true;
}
+ if (bestTarget.width !== activeItem.width) {
+ bestTarget._width = NumCast(activeItem.presWidth, NumCast(bestTarget.width));
+ changed = true;
+ }
+ if (bestTarget.height !== activeItem.height) {
+ bestTarget._height = NumCast(activeItem.presHeight, NumCast(bestTarget.height));
+ changed = true;
+ }
}
if ((pinDataTypes?.viewType && activeItem.presPinViewType !== undefined) || (!pinDataTypes && activeItem.presPinViewType !== undefined)) {
if (bestTarget._viewType !== activeItem.presPinViewType) {
@@ -535,6 +543,8 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
if (pinProps.pinData.inkable) {
pinDoc.presFillColor = targetDoc.fillColor;
pinDoc.presColor = targetDoc.color;
+ pinDoc.presWidth = targetDoc._width;
+ pinDoc.presHeight = targetDoc._height;
}
if (pinProps.pinData.scrollable) pinDoc.presPinViewScroll = targetDoc._scrollTop;
if (pinProps.pinData.clippable) pinDoc.presPinClipWidth = targetDoc._clipWidth;