aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/util/SelectionManager.ts5
-rw-r--r--src/client/views/collections/CollectionFreeFormView.tsx10
-rw-r--r--src/client/views/collections/CollectionView.tsx17
-rw-r--r--src/client/views/nodes/DocumentView.tsx6
4 files changed, 7 insertions, 31 deletions
diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts
index d5d9b29b2..c349e7631 100644
--- a/src/client/util/SelectionManager.ts
+++ b/src/client/util/SelectionManager.ts
@@ -9,11 +9,6 @@ export namespace SelectionManager {
@action
SelectDoc(doc: DocumentView, ctrlPressed: boolean): void {
- //remove preview cursor from collection
- if (doc.props.ContainingCollectionView != undefined) {
- doc.props.ContainingCollectionView.hidePreviewCursor();
- }
-
// if doc is not in SelectedDocuments, add it
if (!ctrlPressed) {
manager.SelectedDocuments = [];
diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx
index c2d2b0f7b..cd88c931b 100644
--- a/src/client/views/collections/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/CollectionFreeFormView.tsx
@@ -90,7 +90,6 @@ export class CollectionFreeFormView extends CollectionViewBase {
if (Math.abs(this._downX - e.clientX) < 3 && Math.abs(this._downY - e.clientY) < 3) {
//show preview text cursor on tap
this._previewCursorVisible = true;
- this.props.CollectionView.showPreviewCursor();
//select is not already selected
if (!this.props.isSelected()) {
this.props.select(false);
@@ -262,17 +261,17 @@ export class CollectionFreeFormView extends CollectionViewBase {
getLocalTransform = (): Transform => Transform.Identity.translate(-this.panX, -this.panY).scale(1 / this.scale);
noScaling = () => 1;
- //hides the preview cursor for generating new text boxes - called when other docs are selected/dragged
+ //when focus is lost, this will remove the preview cursor
@action
- hidePreviewCursor() {
+ onBlur = (e: React.FocusEvent<HTMLInputElement>): void => {
this._previewCursorVisible = false;
}
render() {
+ //determines whether preview text cursor should be visible (ie when user taps this collection it should)
let cursor = null;
- //toggle for preview cursor -> will be on when user taps freeform
- if (this._previewCursorVisible && this.props.CollectionView.isFocusOn) {
+ if (this._previewCursorVisible) {
//get local position and place cursor there!
let [x, y] = this.getTransform().transformPoint(this._downX, this._downY);
cursor = <div id="prevCursor" onKeyPress={this.onKeyDown} style={{ color: "black", position: "absolute", transformOrigin: "left top", transform: `translate(${x}px, ${y}px)` }}>I</div>
@@ -289,6 +288,7 @@ export class CollectionFreeFormView extends CollectionViewBase {
onContextMenu={(e) => e.preventDefault()}
onDrop={this.onDrop.bind(this)}
onDragOver={this.onDragOver}
+ onBlur={this.onBlur}
style={{ borderWidth: `${COLLECTION_BORDER_WIDTH}px`, }}
tabIndex={0}
ref={this.createDropTarget}>
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 6ab0f15c0..11cc6d28e 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -28,8 +28,6 @@ export const COLLECTION_BORDER_WIDTH = 2;
@observer
export class CollectionView extends React.Component<CollectionViewProps> {
- private _focusOn: boolean = false;
-
public static LayoutString(fieldKey: string = "DataKey") {
return `<CollectionView Document={Document}
ScreenToLocalTransform={ScreenToLocalTransform} fieldKey={${fieldKey}} panelWidth={PanelWidth} panelHeight={PanelHeight} isSelected={isSelected} select={select} bindings={bindings}
@@ -73,21 +71,6 @@ export class CollectionView extends React.Component<CollectionViewProps> {
return false
}
-
-
- @computed
- get isFocusOn() { return this._focusOn; }
-
- @action
- showPreviewCursor() {
- this._focusOn = true;
- }
-
- @action
- hidePreviewCursor() {
- this._focusOn = false;
- }
-
get collectionViewType(): CollectionViewType {
let Document = this.props.Document;
let viewField = Document.GetT(KeyStore.ViewType, NumberField);
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index a7632b008..6ff75c4dc 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -113,16 +113,14 @@ export class DocumentView extends React.Component<DocumentViewProps> {
}
}
+
onPointerMove = (e: PointerEvent): void => {
if (e.cancelBubble) {
this._contextMenuCanOpen = false;
return;
}
if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3) {
- //remove preview cursor from collection
- if (this.props.ContainingCollectionView != undefined) {
- this.props.ContainingCollectionView.hidePreviewCursor();
- }
+
this._contextMenuCanOpen = false;
if (this._mainCont.current != null && !this.topMost) {
this._contextMenuCanOpen = false;