diff options
| author | geireann <60007097+geireann@users.noreply.github.com> | 2022-06-05 16:38:46 +0100 |
|---|---|---|
| committer | geireann <60007097+geireann@users.noreply.github.com> | 2022-06-05 16:38:46 +0100 |
| commit | acf19e54a43d5b05c58ef3c80d27086dd64f8e8e (patch) | |
| tree | 9f1231ad34565500496c6023c113e10499ec45ac /src/client/views/collections/TabDocView.tsx | |
| parent | d3e2c8d1be275ed04e0b5164960c3fc60334ce8f (diff) | |
updated and refactored pinWithView
Changed MarqueeView pinWithView so that it just calls TabDocView.PinDoc
Diffstat (limited to 'src/client/views/collections/TabDocView.tsx')
| -rw-r--r-- | src/client/views/collections/TabDocView.tsx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx index ad01be3a3..0cd3fb5a7 100644 --- a/src/client/views/collections/TabDocView.tsx +++ b/src/client/views/collections/TabDocView.tsx @@ -193,10 +193,12 @@ export class TabDocView extends React.Component<TabDocViewProps> { **/ @action public static async PinDoc(doc: Doc, pinProps?: PinProps) { - if (pinProps?.unpin) console.log('TODO: Remove UNPIN from this location'); //add this new doc to props.Document + + // all docs will be added to the ActivePresentation as stored on CurrentUserUtils const curPres = CurrentUserUtils.ActivePresentation; if (curPres) { + // Edge Case 1: Cannot pin document to itself if (doc === curPres) { alert("Cannot pin presentation document to itself"); return; } const batch = UndoManager.StartBatch("pinning doc"); const pinDoc = Doc.MakeAlias(doc); @@ -239,6 +241,13 @@ export class TabDocView extends React.Component<TabDocViewProps> { const dview = CollectionDockingView.Instance.props.Document; const fieldKey = CollectionDockingView.Instance.props.fieldKey; const tabdocs = await DocListCastAsync(dview[fieldKey]); + if (pinProps?.pinWithView) { + const viewProps = pinProps.pinWithView; + pinDoc.presPinView = true; + pinDoc.presPinViewX = viewProps.bounds.left + viewProps.bounds.width / 2; + pinDoc.presPinViewY = viewProps.bounds.top + viewProps.bounds.height / 2; + pinDoc.presPinViewScale = viewProps.scale; + } runInAction(() => { if (!pinProps?.hidePresBox && !tabdocs?.includes(curPres)) { tabdocs?.push(curPres); // bcz: Argh! this is annoying. if multiple documents are pinned, this will get called multiple times before the presentation view is drawn. Thus it won't be in the tabdocs list and it will get created multple times. so need to explicilty add the presbox to the list of open tabs |
