diff options
| author | bobzel <zzzman@gmail.com> | 2022-06-06 21:11:50 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2022-06-06 21:11:50 -0400 |
| commit | 2423a91766d2ec43a8a6e84011ff2faa312786f0 (patch) | |
| tree | c04d0480e8e22a8523f934d81845868e0841c23a /src/client/views/collections/TabDocView.tsx | |
| parent | c29b7151e390f8e5b2090a6e3cd858249703bea7 (diff) | |
| parent | d939e83f1279cb010b3573f0ac02ba4dc7c3cb37 (diff) | |
Merge remote-tracking branch 'origin/pinWithView-refactor'
Diffstat (limited to 'src/client/views/collections/TabDocView.tsx')
| -rw-r--r-- | src/client/views/collections/TabDocView.tsx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx index dab3d490d..0141724ea 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); @@ -218,6 +220,14 @@ export class TabDocView extends React.Component<TabDocViewProps> { const size: number = PresBox.Instance?._selectedArray.size; const presSelected: Doc | undefined = presArray && size ? presArray[size - 1] : undefined; const duration = NumCast(doc[`${Doc.LayoutFieldKey(pinDoc)}-duration`], null); + // If pinWithView option set then update scale and x / y props of slide + 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; + } Doc.AddDocToList(curPres, "data", pinDoc, presSelected); if (!pinProps?.audioRange && duration !== undefined) { pinDoc.mediaStart = "manual"; |
