aboutsummaryrefslogtreecommitdiff
path: root/src/views/freeformcanvas/CollectionFreeFormView.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-01-27 17:59:31 -0500
committerTyler Schicke <tyler_schicke@brown.edu>2019-01-27 17:59:31 -0500
commit5e7fe214c42ef6f31e107255e5c8611a88235674 (patch)
tree8f2644338f51e4479a3e9ea0361189e09a2ac348 /src/views/freeformcanvas/CollectionFreeFormView.tsx
parentb6f8f3f6c75c330430cd593b543e682838f9865d (diff)
Fixed drag drop event handling
Diffstat (limited to 'src/views/freeformcanvas/CollectionFreeFormView.tsx')
-rw-r--r--src/views/freeformcanvas/CollectionFreeFormView.tsx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/views/freeformcanvas/CollectionFreeFormView.tsx b/src/views/freeformcanvas/CollectionFreeFormView.tsx
index 53c5def52..8215e27ac 100644
--- a/src/views/freeformcanvas/CollectionFreeFormView.tsx
+++ b/src/views/freeformcanvas/CollectionFreeFormView.tsx
@@ -43,20 +43,21 @@ export class CollectionFreeFormView extends React.Component<IProps> {
const ele = this._ref.current;
DragManager.MakeDropTarget(this._ref.current, {
handlers: {
- drop: (e: DragManager.DropEvent) => {
- const doc = e.data["document"];
- const xOffset = e.data["xOffset"] as number || 0;
- const yOffset = e.data["yOffset"] as number || 0;
+ drop: (e:Event, de: DragManager.DropEvent) => {
+ const doc = de.data["document"];
+ const xOffset = de.data["xOffset"] as number || 0;
+ const yOffset = de.data["yOffset"] as number || 0;
if (doc instanceof DocumentView) {
const { scale, translateX, translateY } = Utils.GetScreenTransform(ele.children[0] as HTMLElement);
console.log(`${scale} ${translateX} ${translateY}`)
- const screenX = e.x - xOffset;
- const screenY = e.y - yOffset;
+ const screenX = de.x - xOffset;
+ const screenY = de.y - yOffset;
const docX = (screenX - translateX) / scale;
const docY = (screenY - translateY) / scale;
doc.x = docX;
doc.y = docY;
}
+ e.stopPropagation();
}
}
});