aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-10-25 23:36:24 -0400
committerbobzel <zzzman@gmail.com>2020-10-25 23:36:24 -0400
commitf4ab30f9a939587ddebfb50f55d999b458954bfb (patch)
treeda63a7a5afa12888515fd81cd843413643b1ce4d
parent71ed3b7e1a817da7f2aca20da678aaaa4feda3b6 (diff)
fixed placement of link button for scaled text views. fixed document decorations for ContentFittingDocViews & fitWidth items. Fixed documentDeocrations for CollectionMulticolumn view.
-rw-r--r--src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx5
-rw-r--r--src/client/views/nodes/ContentFittingDocumentView.tsx8
-rw-r--r--src/client/views/nodes/DocumentLinksButton.scss6
-rw-r--r--src/client/views/nodes/DocumentLinksButton.tsx4
-rw-r--r--src/client/views/nodes/DocumentView.tsx2
5 files changed, 19 insertions, 6 deletions
diff --git a/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx b/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx
index b99bef15e..6e16137b5 100644
--- a/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx
+++ b/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx
@@ -213,10 +213,9 @@ export class CollectionMulticolumnView extends CollectionSubView(MulticolumnDocu
return this.props.addDocTab(doc, where);
}
getDisplayDoc(layout: Doc, dxf: () => Transform, width: () => number, height: () => number) {
- const layoutTemp = this.props.DataDoc ? true : undefined;
return <ContentFittingDocumentView
Document={layout}
- DataDoc={layout.resolvedDataDoc as Doc || (layoutTemp ? layout : undefined)}
+ DataDoc={layout.resolvedDataDoc as Doc}
backgroundColor={this.props.backgroundColor}
LayoutTemplate={this.props.ChildLayoutTemplate}
LayoutTemplateString={this.props.ChildLayoutString}
@@ -290,6 +289,8 @@ export class CollectionMulticolumnView extends CollectionSubView(MulticolumnDocu
return (
<div className={"collectionMulticolumnView_contents"}
style={{
+ width: `calc(100% - ${2 * NumCast(this.props.Document._xMargin)}px)`,
+ height: `calc(100% - ${2 * NumCast(this.props.Document._yMargin)}px)`,
marginLeft: NumCast(this.props.Document._xMargin), marginRight: NumCast(this.props.Document._xMargin),
marginTop: NumCast(this.props.Document._yMargin), marginBottom: NumCast(this.props.Document._yMargin)
}} ref={this.createDashEventsTarget}>
diff --git a/src/client/views/nodes/ContentFittingDocumentView.tsx b/src/client/views/nodes/ContentFittingDocumentView.tsx
index bc3926ff4..bc3ad5bce 100644
--- a/src/client/views/nodes/ContentFittingDocumentView.tsx
+++ b/src/client/views/nodes/ContentFittingDocumentView.tsx
@@ -38,7 +38,13 @@ export class ContentFittingDocumentView extends React.Component<DocumentViewProp
private PanelHeight = () => this.panelHeight;
@computed get panelWidth() { return this.nativeWidth() && !this.props.Document._fitWidth ? this.nativeWidth() * this.contentScaling() : this.props.PanelWidth(); }
- @computed get panelHeight() { return this.nativeHeight() && !this.props.Document._fitWidth ? this.nativeHeight() * this.contentScaling() : this.props.PanelHeight(); }
+ @computed get panelHeight() {
+ if (this.nativeHeight()) {
+ if (!this.props.Document._fitWidth) return this.nativeHeight() * this.contentScaling()
+ else return this.panelWidth / Doc.NativeAspect(this.layoutDoc, this.props.DataDoc, this.freezeDimensions) || 1;
+ }
+ return this.props.PanelHeight();
+ }
@computed get childXf() { return this.props.DataDoc ? 1 : 1 / this.contentScaling(); } // this is intended to detect when a document is being rendered inside itself as part of a template, but not as a leaf node where nativeWidth & height would apply.
private getTransform = () => this.props.dontCenter ?
diff --git a/src/client/views/nodes/DocumentLinksButton.scss b/src/client/views/nodes/DocumentLinksButton.scss
index 9328fb96b..735aa669f 100644
--- a/src/client/views/nodes/DocumentLinksButton.scss
+++ b/src/client/views/nodes/DocumentLinksButton.scss
@@ -1,6 +1,11 @@
@import "../globalCssVariables.scss";
+.documentLinksButton-cont {
+ min-width: 20;
+ min-height: 20;
+ position: absolute;
+}
.documentLinksButton,
.documentLinksButton-endLink,
.documentLinksButton-startLink {
@@ -29,6 +34,7 @@
.documentLinksButton {
background-color: black;
+ font-weight: bold;
&:hover {
background: $main-accent;
diff --git a/src/client/views/nodes/DocumentLinksButton.tsx b/src/client/views/nodes/DocumentLinksButton.tsx
index ddfb3cc34..a167f2a23 100644
--- a/src/client/views/nodes/DocumentLinksButton.tsx
+++ b/src/client/views/nodes/DocumentLinksButton.tsx
@@ -243,13 +243,13 @@ export class DocumentLinksButton extends React.Component<DocumentLinksButtonProp
src={`/assets/${"link.png"}`} />;
const linkButton = <div className="documentLinksButton-cont" ref={this._linkButton} style={{
- minWidth: 20, minHeight: 20, position: "absolute",
left: this.props.Offset?.[0], top: this.props.Offset?.[1], right: this.props.Offset?.[2], bottom: this.props.Offset?.[3]
}}>
<div className={"documentLinksButton"} style={{
backgroundColor: this.props.InMenu ? "" : "#add8e6",
color: this.props.InMenu ? "white" : "black",
- width: this.props.InMenu ? "20px" : "30px", height: this.props.InMenu ? "20px" : "30px", fontWeight: "bold"
+ width: this.props.InMenu ? "20px" : "30px",
+ height: this.props.InMenu ? "20px" : "30px",
}}
onPointerDown={this.onLinkButtonDown} onClick={this.onLinkClick}
// onPointerLeave={action(() => LinkDocPreview.LinkInfo = undefined)}
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 96ae1dc2b..0b27cd03c 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -920,7 +920,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
return this.isSelected(outsideReaction) || (this.props.Document.rootDocument && this.props.rootSelected?.(outsideReaction)) || false;
}
childScaling = () => (this.layoutDoc._fitWidth ? this.props.PanelWidth() / this.nativeWidth : this.props.ContentScaling());
- @computed.struct get linkOffset() { return this.topMost ? [0, undefined, undefined, 10] : [-15, undefined, undefined, undefined]; }
+ @computed.struct get linkOffset() { return this.topMost ? [0, undefined, undefined, 10] : [-15, undefined, undefined, -20]; }
@computed get contents() {
TraceMobx();
return (<div className="documentView-contentsView" style={{ pointerEvents: this.props.contentsPointerEvents as any, borderRadius: "inherit", width: "100%", height: "100%" }}>