From ed982a553d1831353e312ae8137afa95ef84ebe5 Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 29 Jan 2019 12:20:13 -0500 Subject: semi working docking, but zooming is now broken. --- src/views/nodes/DocumentView.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/views/nodes') diff --git a/src/views/nodes/DocumentView.tsx b/src/views/nodes/DocumentView.tsx index 3ee70213f..517d691f9 100644 --- a/src/views/nodes/DocumentView.tsx +++ b/src/views/nodes/DocumentView.tsx @@ -15,6 +15,7 @@ import { DocumentDecorations } from "../../DocumentDecorations"; import { ContextMenu } from "../ContextMenu"; import { Opt } from "../../fields/Field"; import { DragManager } from "../../util/DragManager"; +import { number } from "prop-types"; const JsxParser = require('react-jsx-parser').default;//TODO Why does this need to be imported like this? interface DocumentViewProps { @@ -193,14 +194,16 @@ export class DocumentView extends React.Component { // // Converts a point in the coordinate space of a document to a screen space coordinate. // - public TransformToScreenPoint(localX: number, localY: number, Ss: number = 1, Panxx: number = 0, Panyy: number = 0): { ScreenX: number, ScreenY: number } { - + public TransformToScreenPoint(localX: number, localY: number, Ss: number = 1, Panxx: number = 0, Panyy: number = 0): { ScreenX: Opt, ScreenY: Opt } { + if (this.props.ContainingCollectionView != undefined && !(this.props.ContainingCollectionView instanceof CollectionFreeFormView)) { + return { ScreenX: undefined, ScreenY: undefined }; + } let W = this.props.Document.GetFieldValue(KeyStore.Width, NumberField, Number(0)); let H = CollectionFreeFormView.BORDER_WIDTH; let Xx = this.props.Document.GetFieldValue(KeyStore.X, NumberField, Number(0)); let Yy = this.props.Document.GetFieldValue(KeyStore.Y, NumberField, Number(0)); - let parentX = (localX - W / 2) * Ss + (Xx + Panxx) + W / 2; - let parentY = (localY - H) * Ss + (Yy + Panyy) + H; + let parentX: Opt = (localX - W / 2) * Ss + (Xx + Panxx) + W / 2; + let parentY: Opt = (localY - H) * Ss + (Yy + Panyy) + H; // if this collection view is nested within another collection view, then // first transform the local point into the parent collection's coordinate space. @@ -295,11 +298,12 @@ export class DocumentView extends React.Component { } render() { + let freeStyling = this.props.ContainingCollectionView instanceof CollectionFreeFormView; return (
@@ -307,5 +311,4 @@ export class DocumentView extends React.Component {
); } - } \ No newline at end of file -- cgit v1.2.3-70-g09d2