aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DocumentManager.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-02-10 22:32:29 -0500
committerbobzel <zzzman@gmail.com>2021-02-10 22:32:29 -0500
commitaed4a386bf57ba7b1b144bacd39f9f9ccabe0dfd (patch)
tree537ea7b01c98e5cdde362984292c4db3173e98c4 /src/client/util/DocumentManager.ts
parentf240c85ff0adee914b43d9d169fa31260e03265d (diff)
simplified focus'ing on documents. refactored scrollFocus code. changed focus in 2D to move doc into view but not center.
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r--src/client/util/DocumentManager.ts11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index 9a8b662e7..ac7710d34 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -150,29 +150,26 @@ export class DocumentManager {
};
const docView = getFirstDocView(targetDoc, originatingDoc);
let annotatedDoc = Cast(targetDoc.annotationOn, Doc, null);
- if (annotatedDoc && annotatedDoc !== originatingDoc?.context && !targetDoc?.isPushpin) {
+ if (!docView && annotatedDoc && annotatedDoc !== originatingDoc?.context && targetDoc.type === DocumentType.TEXTANCHOR) {
const first = getFirstDocView(annotatedDoc);
if (first) {
annotatedDoc = first.rootDoc;
first.focus(targetDoc, false);
}
- }
- if (docView) { // we have a docView already and aren't forced to create a new one ... just focus on the document. TODO move into view if necessary otherwise just highlight?
- const sameContext = annotatedDoc && annotatedDoc === originatingDoc?.context;
+ } else if (docView) { // we have a docView already and aren't forced to create a new one ... just focus on the document. TODO move into view if necessary otherwise just highlight?
if (originatingDoc?.isPushpin) {
docView.props.focus(docView.rootDoc, willZoom, undefined, (didFocus: boolean) => {
if (!didFocus || docView.rootDoc.hidden) {
docView.rootDoc.hidden = !docView.rootDoc.hidden;
}
return focusAndFinish();
- }, sameContext, false);// don't want to focus the container if the source and target are in the same container, so pass 'sameContext' for dontCenter parameter
- //finished?.();
+ });
}
else {
docView.select(false);
docView.rootDoc.hidden && (docView.rootDoc.hidden = undefined);
// @ts-ignore
- docView.props.focus(docView.rootDoc, willZoom, undefined, focusAndFinish, sameContext, false);
+ docView.props.focus(docView.rootDoc, willZoom, undefined, focusAndFinish);
}
highlight();
} else {