aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
authorlaurawilsonri <laura_wilson@brown.edu>2019-02-25 20:58:11 -0500
committerlaurawilsonri <laura_wilson@brown.edu>2019-02-25 20:58:11 -0500
commit11327191e249382cc5d2551f1fd262d3a4ff25b9 (patch)
treee8f9d796d707e9a4b88458315484afd50903ec47 /src/client/views/collections
parent3ef178ab23eae665a7323ae54e14114a2b6e656e (diff)
ALL SETgit add -A
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/CollectionFreeFormView.tsx10
-rw-r--r--src/client/views/collections/CollectionView.tsx17
2 files changed, 5 insertions, 22 deletions
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);