From 22b53b6070d777ee992e32e16cccebb0c104adf5 Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 15 Oct 2020 13:26:04 +0800 Subject: pin with view on scrollable documents and some undo bug fixes --- .../views/presentationview/PresElementBox.tsx | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src/client/views/presentationview') diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx index adaabec8a..9a6e4313d 100644 --- a/src/client/views/presentationview/PresElementBox.tsx +++ b/src/client/views/presentationview/PresElementBox.tsx @@ -242,6 +242,23 @@ export class PresElementBox extends ViewBoxBaseComponent { + console.log(targetDoc.type); + if (targetDoc.type === DocumentType.PDF || targetDoc.type === DocumentType.WEB || targetDoc.type === DocumentType.RTF) { + const scroll = targetDoc._scrollTop; + activeItem.presPinViewScroll = scroll; + } else { + const x = targetDoc._panX; + const y = targetDoc._panY; + const scale = targetDoc._viewScale; + activeItem.presPinViewX = x; + activeItem.presPinViewY = y; + activeItem.presPinViewScale = scale; + } + } + @computed get mainItem() { const isSelected: boolean = PresBox.Instance._selectedArray.includes(this.rootDoc); const isDragging: boolean = BoolCast(this.rootDoc.dragging); @@ -300,14 +317,7 @@ export class PresElementBox extends ViewBoxBaseComponent
{"Update view"}
}>
{ - const x = targetDoc._panX; - const y = targetDoc._panY; - const scale = targetDoc._viewScale; - activeItem.presPinViewX = x; - activeItem.presPinViewY = y; - activeItem.presPinViewScale = scale; - }} + onClick={() => this.pinWithView(targetDoc, activeItem)} style={{ fontWeight: 700, display: activeItem.presPinView ? "flex" : "none" }}>V
{this.rootDoc.presExpandInlineButton ? "Minimize" : "Expand"}
}>
{ e.stopPropagation(); this.presExpandDocumentClick(); }}> @@ -321,7 +331,7 @@ export class PresElementBox extends ViewBoxBaseComponent {this.renderEmbeddedInline}
- ); + ); } render() { -- cgit v1.2.3-70-g09d2