aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/PreviewCursor.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-04-13 11:15:59 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-04-13 11:15:59 -0400
commitb235c94614141752c98d24a395682a02297d9e6a (patch)
treed270bec7a9a6a6014e8ef7a6dd616670f8f93577 /src/client/views/PreviewCursor.tsx
parent290feed8a7c2ae700bac0d720874abc511e6cd36 (diff)
cleaned up rootSelected() to work with templates. adjusted nudge to favor moving documents over panning collection
Diffstat (limited to 'src/client/views/PreviewCursor.tsx')
-rw-r--r--src/client/views/PreviewCursor.tsx14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/client/views/PreviewCursor.tsx b/src/client/views/PreviewCursor.tsx
index ecebadd2a..92ba13d2f 100644
--- a/src/client/views/PreviewCursor.tsx
+++ b/src/client/views/PreviewCursor.tsx
@@ -13,7 +13,7 @@ export class PreviewCursor extends React.Component<{}> {
static _getTransform: () => Transform;
static _addLiveTextDoc: (doc: Doc) => void;
static _addDocument: (doc: Doc) => boolean;
- static _nudge: (x: number, y: number) => void;
+ static _nudge: (x: number, y: number) => boolean;
@observable static _clickPoint = [0, 0];
@observable public static Visible = false;
constructor(props: any) {
@@ -91,17 +91,13 @@ export class PreviewCursor extends React.Component<{}> {
}
} else if (PreviewCursor.Visible) {
if (e.key === "ArrowRight") {
- PreviewCursor._nudge?.(1 * (e.shiftKey ? 2 : 1), 0);
- e.stopPropagation();
+ PreviewCursor._nudge?.(1 * (e.shiftKey ? 2 : 1), 0) && e.stopPropagation();
} else if (e.key === "ArrowLeft") {
- PreviewCursor._nudge?.(-1 * (e.shiftKey ? 2 : 1), 0);
- e.stopPropagation();
+ PreviewCursor._nudge?.(-1 * (e.shiftKey ? 2 : 1), 0) && e.stopPropagation();
} else if (e.key === "ArrowUp") {
- PreviewCursor._nudge?.(0, 1 * (e.shiftKey ? 2 : 1));
- e.stopPropagation();
+ PreviewCursor._nudge?.(0, 1 * (e.shiftKey ? 2 : 1)) && e.stopPropagation();
} else if (e.key === "ArrowDown") {
- PreviewCursor._nudge?.(0, -1 * (e.shiftKey ? 2 : 1));
- e.stopPropagation();
+ PreviewCursor._nudge?.(0, -1 * (e.shiftKey ? 2 : 1)) && e.stopPropagation();
}
}
}