diff options
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/collections/CollectionDockingView.tsx | 12 | ||||
-rw-r--r-- | src/views/nodes/DocumentView.tsx | 10 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/views/collections/CollectionDockingView.tsx b/src/views/collections/CollectionDockingView.tsx index cdcdf3bf1..19b212bde 100644 --- a/src/views/collections/CollectionDockingView.tsx +++ b/src/views/collections/CollectionDockingView.tsx @@ -77,6 +77,7 @@ export class CollectionDockingView extends React.Component<CollectionViewProps> } public static BORDER_WIDTH = 2; + public static TAB_HEADER_HEIGHT = 20; @computed public get active(): boolean { @@ -131,7 +132,6 @@ export class CollectionDockingView extends React.Component<CollectionViewProps> if (component === "button") { return <button>{node.getName()}</button>; } - console.log("Gettting " + component); const { fieldKey, Document: Document } = this.props; const value: Document[] = Document.GetFieldValue(fieldKey, ListField, []); if (component === "doc1" && value.length > 0) { @@ -153,8 +153,10 @@ export class CollectionDockingView extends React.Component<CollectionViewProps> const value: Document[] = Document.GetFieldValue(fieldKey, ListField, []); // bcz: not sure why, but I need these to force the flexlayout to update when the collection size changes. - var w = Document.GetFieldValue(KeyStore.Width, NumberField, Number(0)); - var h = Document.GetFieldValue(KeyStore.Height, NumberField, Number(0)); + var s = this.props.ContainingDocumentView!.ScalingToScreenSpace; + var w = Document.GetFieldValue(KeyStore.Width, NumberField, Number(0)) / s; + var h = Document.GetFieldValue(KeyStore.Height, NumberField, Number(0)) / s; + return ( <div className="border" style={{ borderStyle: "solid", @@ -162,8 +164,8 @@ export class CollectionDockingView extends React.Component<CollectionViewProps> }}> <div className="collectiondockingview-container" onPointerDown={this.onPointerDown} onContextMenu={(e) => e.preventDefault()} ref={this._containerRef} style={{ - width: "100%", - height: `calc(100% - 2*${CollectionDockingView.BORDER_WIDTH}px)`, + width: s > 1 ? "100%" : w - 2 * CollectionDockingView.BORDER_WIDTH, + height: s > 1 ? "100%" : h - 2 * CollectionDockingView.BORDER_WIDTH }} > <FlexLayout.Layout model={this._model} factory={this.factory} /> </div> diff --git a/src/views/nodes/DocumentView.tsx b/src/views/nodes/DocumentView.tsx index 5ce64b347..7ba62e0b8 100644 --- a/src/views/nodes/DocumentView.tsx +++ b/src/views/nodes/DocumentView.tsx @@ -178,8 +178,9 @@ export class DocumentView extends React.Component<DocumentViewProps> { ContainerY = LocalY - 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 dockingViewChromeHack = this.props.ContainingCollectionView instanceof CollectionDockingView; + let Xx = dockingViewChromeHack ? 0 : this.props.Document.GetFieldValue(KeyStore.X, NumberField, Number(0)); + let Yy = dockingViewChromeHack ? CollectionDockingView.TAB_HEADER_HEIGHT : this.props.Document.GetFieldValue(KeyStore.Y, NumberField, Number(0)); let Ss = this.props.Document.GetFieldValue(KeyStore.Scale, NumberField, Number(1)); let Panxx = this.props.Document.GetFieldValue(KeyStore.PanX, NumberField, Number(0)); let Panyy = this.props.Document.GetFieldValue(KeyStore.PanY, NumberField, Number(0)); @@ -196,10 +197,11 @@ export class DocumentView extends React.Component<DocumentViewProps> { // if (this.props.ContainingCollectionView != undefined && !(this.props.ContainingCollectionView instanceof CollectionFreeFormView)) { // return { ScreenX: undefined, ScreenY: undefined }; // } + let dockingViewChromeHack = this.props.ContainingCollectionView instanceof CollectionDockingView; let W = CollectionFreeFormView.BORDER_WIDTH; // 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 Xx = dockingViewChromeHack ? 0 : this.props.Document.GetFieldValue(KeyStore.X, NumberField, Number(0)); + let Yy = dockingViewChromeHack ? CollectionDockingView.TAB_HEADER_HEIGHT : this.props.Document.GetFieldValue(KeyStore.Y, NumberField, Number(0)); let parentX: Opt<any> = (localX - W) * Ss + (Xx + Panxx) + W; let parentY: Opt<any> = (localY - H) * Ss + (Yy + Panyy) + H; |