aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DocumentManager.ts
diff options
context:
space:
mode:
authorkimdahey <claire_kim1@brown.edu>2019-10-02 17:21:38 -0400
committerkimdahey <claire_kim1@brown.edu>2019-10-02 17:21:38 -0400
commit49d90a9a2b1d799a3ffdddf8ab45dc0d5c4fdb5b (patch)
tree8ce177e1cdc399352bba50b5564e75b64b6658a8 /src/client/util/DocumentManager.ts
parenta8f14c501cf676f6a2697b73d7f2a162d4100a9e (diff)
parenta19210e7db3e625c0bfe38b4f13b5312cc0c6e53 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into webcam_mohammad
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r--src/client/util/DocumentManager.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index c048125c5..4e6968f08 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -11,6 +11,7 @@ import { LinkManager } from './LinkManager';
import { undoBatch, UndoManager } from './UndoManager';
import { Scripting } from './Scripting';
import { List } from '../../new_fields/List';
+import { SelectionManager } from './SelectionManager';
export class DocumentManager {
@@ -132,7 +133,7 @@ export class DocumentManager {
let doc = Doc.GetProto(docDelegate);
const contextDoc = await Cast(doc.annotationOn, Doc);
if (contextDoc) {
- contextDoc.scrollY = NumCast(doc.y) - NumCast(contextDoc.height) / 2;
+ contextDoc.scrollY = NumCast(doc.y) - NumCast(contextDoc.height) / 2 * 72 / 96;
}
let docView: DocumentView | null;
@@ -171,9 +172,17 @@ export class DocumentManager {
} else {
let contextView: DocumentView | null;
Doc.BrushDoc(docDelegate);
- if (!forceDockFunc && (contextView = DocumentManager.Instance.getDocumentView(contextDoc))) {
+ let contextViews = DocumentManager.Instance.getDocumentViews(contextDoc);
+ if (!forceDockFunc && contextViews.length) {
+ contextView = contextViews[0];
+ SelectionManager.SelectDoc(contextView, false); // force unrendered annotations to be created
contextDoc.panTransformType = "Ease";
- contextView.props.focus(docDelegate, willZoom);
+ setTimeout(() => {
+ SelectionManager.DeselectDoc(contextView!);
+ docView = DocumentManager.Instance.getDocumentView(docDelegate);
+ docView && contextView!.props.focus(contextView!.props.Document, willZoom);
+ docView && UndoManager.RunInBatch(() => docView!.props.focus(docView!.props.Document, willZoom), "focus");
+ }, 0);
} else {
(dockFunc || CollectionDockingView.AddRightSplit)(contextDoc, undefined);
setTimeout(() => {