From 25d56d2f490ca6c8ea685b832332605a7fc6042a Mon Sep 17 00:00:00 2001
From: bob <bcz@cs.brown.edu>
Date: Fri, 5 Apr 2019 09:56:48 -0400
Subject: fixed exception w/ brushing.   added undo for dragging items into
 workspace.

---
 src/client/views/Main.tsx | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'src/client/views/Main.tsx')

diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index 6f66f8f38..a324421ac 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -13,7 +13,7 @@ import { Documents } from '../documents/Documents';
 import { Server } from '../Server';
 import { setupDrag } from '../util/DragManager';
 import { Transform } from '../util/Transform';
-import { UndoManager } from '../util/UndoManager';
+import { UndoManager, undoBatch } from '../util/UndoManager';
 import { WorkspacesMenu } from '../../server/authentication/controllers/WorkspacesMenu';
 import { CollectionDockingView } from './collections/CollectionDockingView';
 import { ContextMenu } from './ContextMenu';
@@ -51,6 +51,7 @@ import '../northstar/utils/Extensions'
 import { HistogramOperation } from '../northstar/operations/HistogramOperation';
 import { AttributeTransformationModel } from '../northstar/core/attribute/AttributeTransformationModel';
 import { ColumnAttributeModel } from '../northstar/core/attribute/AttributeModel';
+import { CollectionView } from './collections/CollectionView';
 
 @observer
 export class Main extends React.Component {
@@ -234,6 +235,15 @@ export class Main extends React.Component {
                 ContainingCollectionView={undefined} />
     }
 
+    @undoBatch
+    @action
+    prepareDrag = (
+        _reference: React.RefObject<HTMLDivElement>,
+        docFunc: () => Document,
+        removeFunc: (containingCollection: CollectionView) => void = () => { }) => {
+        return setupDrag(_reference, docFunc, removeFunc);
+    }
+
     /* for the expandable add nodes menu. Not included with the miscbuttons because once it expands it expands the whole div with it, making canvas interactions limited. */
     @computed
     get nodesMenu() {
@@ -273,7 +283,7 @@ export class Main extends React.Component {
                 <ul id="add-options-list">
                     {btns.map(btn =>
                         <li key={btn[1]} ><div ref={btn[0]}>
-                            <button className="round-button add-button" title={btn[2]} onPointerDown={setupDrag(btn[0], btn[3])}>
+                            <button className="round-button add-button" title={btn[2]} onPointerDown={this.prepareDrag(btn[0], btn[3])}>
                                 <FontAwesomeIcon icon={btn[1]} size="sm" />
                             </button>
                         </div></li>)}
-- 
cgit v1.2.3-70-g09d2


From b680f3db2f9fb6dc65f47848234e96453ef60a5c Mon Sep 17 00:00:00 2001
From: Tyler Schicke <tyler_schicke@brown.edu>
Date: Sat, 6 Apr 2019 04:09:32 -0400
Subject: Removed prepareDrag

---
 src/client/views/Main.tsx | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

(limited to 'src/client/views/Main.tsx')

diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index a324421ac..237eb3b6e 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -235,15 +235,6 @@ export class Main extends React.Component {
                 ContainingCollectionView={undefined} />
     }
 
-    @undoBatch
-    @action
-    prepareDrag = (
-        _reference: React.RefObject<HTMLDivElement>,
-        docFunc: () => Document,
-        removeFunc: (containingCollection: CollectionView) => void = () => { }) => {
-        return setupDrag(_reference, docFunc, removeFunc);
-    }
-
     /* for the expandable add nodes menu. Not included with the miscbuttons because once it expands it expands the whole div with it, making canvas interactions limited. */
     @computed
     get nodesMenu() {
@@ -283,7 +274,7 @@ export class Main extends React.Component {
                 <ul id="add-options-list">
                     {btns.map(btn =>
                         <li key={btn[1]} ><div ref={btn[0]}>
-                            <button className="round-button add-button" title={btn[2]} onPointerDown={this.prepareDrag(btn[0], btn[3])}>
+                            <button className="round-button add-button" title={btn[2]} onPointerDown={setupDrag(btn[0], btn[3])}>
                                 <FontAwesomeIcon icon={btn[1]} size="sm" />
                             </button>
                         </div></li>)}
-- 
cgit v1.2.3-70-g09d2

