aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/Main.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-04-12 21:18:30 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-04-12 21:18:30 -0400
commitdb9ee4f0d710d132e33e48cf6f105fd945941003 (patch)
tree505c1b4ecba7b1b7cce4a77f3e3e55b5933a8e03 /src/client/views/Main.tsx
parente3caa89d36c501c16acbc56900546d8a4522584a (diff)
combined preview cursor with marquee. moved preview cursor prompt to its own file.
Diffstat (limited to 'src/client/views/Main.tsx')
-rw-r--r--src/client/views/Main.tsx39
1 files changed, 2 insertions, 37 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index 80e19c4f5..ed61aa5a7 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -40,44 +40,9 @@ import { DocumentView } from './nodes/DocumentView';
import { FormattedTextBox } from './nodes/FormattedTextBox';
import { REPLCommand } from 'repl';
import { Key } from '../../fields/Key';
-import { truncate } from 'fs';
+import { PreviewCursor } from './PreviewCursor';
-export interface PromptProps {
-}
-
-@observer
-export class PreviewCursorPrompt extends React.Component<PromptProps> {
- private _prompt = React.createRef<HTMLDivElement>();
- //when focus is lost, this will remove the preview cursor
- @action onBlur = (): void => {
- PreviewCursorPrompt.Visible = false;
- PreviewCursorPrompt.hide();
- }
-
- @observable static clickPoint = [0, 0];
- @observable public static Visible = false;
- @observable public static hide = () => { };
- @action
- public static Show(hide: any, x: number, y: number) {
- this.clickPoint = [x, y];
- this.hide = hide;
- setTimeout(action(() => this.Visible = true), (1));
- }
- render() {
- if (!PreviewCursorPrompt.clickPoint) {
- return (null);
- }
- if (PreviewCursorPrompt.Visible && this._prompt.current) {
- this._prompt.current.focus();
- }
- let p = PreviewCursorPrompt.clickPoint;
- return <div className="previewCursor" id="previewCursor" onBlur={this.onBlur} tabIndex={0} ref={this._prompt}
- style={{ transform: `translate(${p[0]}px, ${p[1]}px)`, opacity: PreviewCursorPrompt.Visible ? 1 : 0 }}>
- I
- </div >;
- }
-}
@observer
export class Main extends React.Component {
// dummy initializations keep the compiler happy
@@ -429,7 +394,7 @@ export class Main extends React.Component {
{({ measureRef }) =>
<div ref={measureRef} id="mainContent-div">
{this.mainContent}
- <PreviewCursorPrompt />
+ <PreviewCursor />
</div>
}
</Measure>