From 7bc8bf62d9c9ff8e388103d0faa75855d43b8e16 Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 29 Jan 2019 12:55:59 -0500 Subject: fixed zooming --- src/views/collections/CollectionFreeFormView.scss | 4 +-- src/views/nodes/DocumentView.tsx | 42 +++++++++++++++-------- 2 files changed, 29 insertions(+), 17 deletions(-) (limited to 'src/views') diff --git a/src/views/collections/CollectionFreeFormView.scss b/src/views/collections/CollectionFreeFormView.scss index 2b68ba981..1563712fb 100644 --- a/src/views/collections/CollectionFreeFormView.scss +++ b/src/views/collections/CollectionFreeFormView.scss @@ -1,10 +1,10 @@ .collectionfreeformview-container { - position: absolute; + position: relative; top: 0; left: 0; overflow: hidden; .collectionfreeformview { - position: absolute; + position: relative; top: 0; left: 0; } diff --git a/src/views/nodes/DocumentView.tsx b/src/views/nodes/DocumentView.tsx index 517d691f9..3b9e6cc04 100644 --- a/src/views/nodes/DocumentView.tsx +++ b/src/views/nodes/DocumentView.tsx @@ -15,7 +15,6 @@ 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 { @@ -202,8 +201,8 @@ export class DocumentView extends React.Component { 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: Opt = (localX - W / 2) * Ss + (Xx + Panxx) + W / 2; - let parentY: Opt = (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. @@ -297,18 +296,31 @@ export class DocumentView extends React.Component { } } + render() { - let freeStyling = this.props.ContainingCollectionView instanceof CollectionFreeFormView; - return ( -
- -
- ); + var freestyling = this.props.ContainingCollectionView === undefined || this.props.ContainingCollectionView instanceof CollectionFreeFormView; + if (freestyling) + return ( +
+ +
+ ); + else + return ( +
+ +
+ ); } } \ No newline at end of file -- cgit v1.2.3-70-g09d2