From d8ff5b1effe0db563defc2a6e1391b9b0d160e67 Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 29 Jan 2019 14:43:42 -0500 Subject: intermediate state -- things don't resize properly yet. --- src/views/collections/CollectionFreeFormView.tsx | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/views/collections/CollectionFreeFormView.tsx') diff --git a/src/views/collections/CollectionFreeFormView.tsx b/src/views/collections/CollectionFreeFormView.tsx index a1224f4da..c84b8e3e5 100644 --- a/src/views/collections/CollectionFreeFormView.tsx +++ b/src/views/collections/CollectionFreeFormView.tsx @@ -34,25 +34,17 @@ export class CollectionFreeFormView extends React.Component } drop = (e: Event, de: DragManager.DropEvent) => { - const ele = this._canvasRef.current; - if (!ele) { - return; - } 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) { if (doc.props.ContainingCollectionView && doc.props.ContainingCollectionView !== this) { doc.props.ContainingCollectionView.removeDocument(doc.props.Document); this.addDocument(doc.props.Document); } - const { scale, translateX, translateY } = Utils.GetScreenTransform(ele); - 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; + const xOffset = de.data[ "xOffset" ] as number || 0; + const yOffset = de.data[ "yOffset" ] as number || 0; + let { LocalX, LocalY } = this.props.ContainingDocumentView!.TransformToLocalPoint(de.x - xOffset, de.y - yOffset); + doc.x = LocalX; + doc.y = LocalY; } e.stopPropagation(); } -- cgit v1.2.3-70-g09d2