From 7bc8bf62d9c9ff8e388103d0faa75855d43b8e16 Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 29 Jan 2019 12:55:59 -0500 Subject: fixed zooming --- src/Main.tsx | 7 ++-- src/views/collections/CollectionFreeFormView.scss | 4 +-- src/views/nodes/DocumentView.tsx | 42 +++++++++++++++-------- 3 files changed, 33 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/Main.tsx b/src/Main.tsx index 1b5d95132..566216373 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -61,7 +61,8 @@ runInAction(() => { let doc5 = Documents.ImageDocument("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg", { x: 650, y: 500, width: 600, height: 600 }); - let doc6 = Documents.DockDocument(docset, { + let docset2 = new Array(doc1, doc4, doc3); + let doc6 = Documents.DockDocument(docset2, { x: 350, y: 100 }); let mainNodes = mainContainer.GetFieldT(KeyStore.Data, ListField); @@ -74,7 +75,7 @@ runInAction(() => { mainNodes.Data.push(doc4); // mainNodes.Data.push(doc3); mainNodes.Data.push(doc5); - mainNodes.Data.push(doc1); - mainNodes.Data.push(doc2); + // mainNodes.Data.push(doc1); + // mainNodes.Data.push(doc2); mainNodes.Data.push(doc6); }); \ No newline at end of file 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