From 11327191e249382cc5d2551f1fd262d3a4ff25b9 Mon Sep 17 00:00:00 2001
From: laurawilsonri <laura_wilson@brown.edu>
Date: Mon, 25 Feb 2019 20:58:11 -0500
Subject: ALL SETgit add -A

---
 src/client/views/collections/CollectionFreeFormView.tsx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'src/client/views/collections/CollectionFreeFormView.tsx')

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}>
-- 
cgit v1.2.3-70-g09d2

