aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/TabDocView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-18 09:24:23 -0400
committerGitHub <noreply@github.com>2020-09-18 09:24:23 -0400
commitfebc90a749df74a59cadcf18b178c0b5c6863dca (patch)
tree51f1448083f985a95c23c2219a4d9a739b23d7e7 /src/client/views/collections/TabDocView.tsx
parent88fbc391b3dd3f36a2e7015bc59c3a306d3e7d57 (diff)
parent8e672ed0e062b9483d3c0e19fa5e2e0a505a0472 (diff)
Merge pull request #749 from browngraphicslab/presentation_v1
Presentation v1 - fixed the merge issues from presentation_updates
Diffstat (limited to 'src/client/views/collections/TabDocView.tsx')
-rw-r--r--src/client/views/collections/TabDocView.tsx50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index f89285923..1be85cfc1 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -22,7 +22,7 @@ import { SnappingManager } from '../../util/SnappingManager';
import { Transform } from '../../util/Transform';
import { undoBatch, UndoManager } from "../../util/UndoManager";
import { DocumentView } from "../nodes/DocumentView";
-import { PresBox } from '../nodes/PresBox';
+import { PresBox, PresMovement } from '../nodes/PresBox';
import { CollectionDockingView } from './CollectionDockingView';
import { CollectionDockingViewMenu } from './CollectionDockingViewMenu';
import { CollectionFreeFormView } from './collectionFreeForm/CollectionFreeFormView';
@@ -122,27 +122,27 @@ export class TabDocView extends React.Component<TabDocViewProps> {
**/
@undoBatch
@action
- public static PinDoc(doc: Doc, unpin = false) {
- if (unpin) TabDocView.UnpinDoc(doc);
- else {
- //add this new doc to props.Document
- const curPres = CurrentUserUtils.ActivePresentation;
- if (curPres) {
- const pinDoc = Doc.MakeAlias(doc);
- pinDoc.presentationTargetDoc = doc;
- pinDoc.presZoomButton = true;
- pinDoc.context = curPres;
- Doc.AddDocToList(curPres, "data", pinDoc);
- if (curPres.expandBoolean) pinDoc.presExpandInlineButton = true;
- if (!DocumentManager.Instance.getDocumentView(curPres)) {
- CollectionDockingView.AddSplit(curPres, "right");
- }
- DocumentManager.Instance.jumpToDocument(doc, false, undefined, Cast(doc.context, Doc, null));
- setTimeout(() => {
- curPres._itemIndex = DocListCast(curPres.data).length - 1;
- doc.treeViewOutlineMode && PresBox.Instance.progressivizeChild(null as any);
- }, 100);
+ public static PinDoc(doc: Doc, unpin = false, audioRange?: boolean) {
+ if (unpin) console.log('remove unpin');
+ //add this new doc to props.Document
+ const curPres = CurrentUserUtils.ActivePresentation;
+ if (curPres) {
+ const pinDoc = Doc.MakeAlias(doc);
+ pinDoc.presentationTargetDoc = doc;
+ pinDoc.title = doc.title;
+ pinDoc.presMovement = PresMovement.Zoom;
+ pinDoc.context = curPres;
+ Doc.AddDocToList(curPres, "data", pinDoc);
+ if (pinDoc.type === "audio" && !audioRange) {
+ pinDoc.presStartTime = 0;
+ pinDoc.presEndTime = doc.duration;
}
+ if (curPres.expandBoolean) pinDoc.presExpandInlineButton = true;
+ const curPresDocView = DocumentManager.Instance.getDocumentView(curPres);
+ if (!curPresDocView) {
+ CollectionDockingView.AddSplit(curPres, "right");
+ }
+ DocumentManager.Instance.jumpToDocument(doc, false, undefined, Cast(doc.context, Doc, null));
}
}
@@ -169,7 +169,7 @@ export class TabDocView extends React.Component<TabDocViewProps> {
})).observe(this.props.glContainer._element[0]);
this.props.glContainer.layoutManager.on("activeContentItemChanged", this.onActiveContentItemChanged);
this.props.glContainer.tab?.isActive && this.onActiveContentItemChanged();
- this._tabReaction = reaction(() => ({ selected: selected(), color: this.tabColor, title: this.tab.titleElement[0] }),
+ this._tabReaction = reaction(() => ({ selected: selected(), color: this.tabColor, title: this.tab?.titleElement[0] }),
({ selected, color, title }) => title && (title.style.backgroundColor = selected ? color : ""),
{ fireImmediately: true });
}
@@ -318,7 +318,9 @@ export class TabDocView extends React.Component<TabDocViewProps> {
</>;
}
focusFunc = (doc: Doc, willZoom: boolean, scale?: number, afterFocus?: () => void) => {
- this.tab.header.parent.setActiveContentItem(this.tab.contentItem);
+ if (!this.tab.header.parent._activeContentItem || this.tab.header.parent._activeContentItem !== this.tab.contentItem) {
+ this.tab.header.parent.setActiveContentItem(this.tab.contentItem); // glr: Panning does not work when this is set - (this line is for trying to make a tab that is not topmost become topmost)
+ }
afterFocus?.();
}
setView = action((view: DocumentView) => this._view = view);
@@ -371,4 +373,4 @@ export class TabDocView extends React.Component<TabDocViewProps> {
{this.docView}
</div >);
}
-}
+} \ No newline at end of file