diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.tsx | 7 | ||||
-rw-r--r-- | src/views/collections/CollectionFreeFormView.scss | 4 | ||||
-rw-r--r-- | src/views/nodes/DocumentView.tsx | 42 |
3 files changed, 33 insertions, 20 deletions
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<Document>(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<DocumentViewProps> { 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<number> = (localX - W / 2) * Ss + (Xx + Panxx) + W / 2; - let parentY: Opt<number> = (localY - H) * Ss + (Yy + Panyy) + H; + let parentX: Opt<any> = (localX - W / 2) * Ss + (Xx + Panxx) + W / 2; + let parentY: Opt<any> = (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<DocumentViewProps> { } } + render() { - let freeStyling = this.props.ContainingCollectionView instanceof CollectionFreeFormView; - return ( - <div className="node" ref={this._mainCont} style={{ - transform: freeStyling ? this.transform : "", - width: freeStyling ? this.width : "100%", - height: freeStyling ? this.height : "100%", - }} - onContextMenu={this.onContextMenu} - onPointerDown={this.onPointerDown}> - <DocumentContents {...this.props} ContainingDocumentView={this} /> - </div> - ); + var freestyling = this.props.ContainingCollectionView === undefined || this.props.ContainingCollectionView instanceof CollectionFreeFormView; + if (freestyling) + return ( + <div className="node" ref={this._mainCont} style={{ + transform: this.transform, + width: this.width, + height: this.height, + }} + onContextMenu={this.onContextMenu} + onPointerDown={this.onPointerDown}> + <DocumentContents {...this.props} ContainingDocumentView={this} /> + </div> + ); + else + return ( + <div className="node" ref={this._mainCont} style={{ + width: "100%", + height: "100%", + }} + onContextMenu={this.onContextMenu} + onPointerDown={this.onPointerDown}> + <DocumentContents {...this.props} ContainingDocumentView={this} /> + </div> + ); } }
\ No newline at end of file |