aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2019-02-12 22:43:23 -0500
committerbobzel <zzzman@gmail.com>2019-02-12 22:43:23 -0500
commit9cb0bf595b47d6a76113e3ed2f99d34e1713904e (patch)
treeddfdebccf59a42219cb9e7d2f7325dba986984ed
parentb48e9b7850d0d244ce1fe519863b32969ed2c7d2 (diff)
more minor api cleanup
-rw-r--r--src/client/views/DocumentDecorations.tsx4
-rw-r--r--src/client/views/nodes/DocumentView.tsx30
2 files changed, 21 insertions, 13 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index cc43372af..1224495f6 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -26,8 +26,8 @@ export class DocumentDecorations extends React.Component {
!(element.props.ContainingCollectionView instanceof CollectionFreeFormView)) {
return bounds;
}
- var spt = element.TransformToScreenPoint(0, 0, 1, 0, 0, false);
- var bpt = element.TransformToScreenPoint(element.width, element.height, 1, 0, 0, false);
+ var spt = element.TransformToScreenPoint(0, 0);
+ var bpt = element.TransformToScreenPoint(element.width, element.height);
return {
x: Math.min(spt.ScreenX, bounds.x), y: Math.min(spt.ScreenY, bounds.y),
r: Math.max(bpt.ScreenX, bounds.r), b: Math.max(bpt.ScreenY, bounds.b)
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 9607a4984..355e431e6 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -130,7 +130,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
//
// Converts a point in the coordinate space of the document to coordinate in app screen coordinates
//
- public TransformToScreenPoint(localX: number, localY: number, Ss: number = 1, Panxx: number = 0, Panyy: number = 0, apply: boolean = true): { ScreenX: number, ScreenY: number } {
+ public TransformToScreenPoint(localX: number, localY: number, Ss: number = 1, Panxx: number = 0, Panyy: number = 0, apply: boolean = false): { ScreenX: number, ScreenY: number } {
var parentScaling = apply ? this.parentScaling : 1;
let parentX = (Panxx + (localX - COLLECTION_BORDER_WIDTH) * Ss) * parentScaling + this.LeftCorner();
@@ -143,7 +143,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
let ss = containingDocView.props.Document.GetNumber(KeyStore.Scale, 1);
let panxx = containingDocView.props.Document.GetNumber(KeyStore.PanX, 0) + COLLECTION_BORDER_WIDTH * ss * parentScaling;
let panyy = containingDocView.props.Document.GetNumber(KeyStore.PanY, 0) + COLLECTION_BORDER_WIDTH * ss * parentScaling;
- let { ScreenX, ScreenY } = containingDocView.TransformToScreenPoint(parentX, parentY, ss, panxx, panyy);
+ let { ScreenX, ScreenY } = containingDocView.TransformToScreenPoint(parentX, parentY, ss, panxx, panyy, true);
parentX = ScreenX;
parentY = ScreenY;
}
@@ -163,20 +163,28 @@ export class DocumentView extends React.Component<DocumentViewProps> {
if (bindings.DocumentView === undefined) {
bindings.DocumentView = this; // set the DocumentView to this if it hasn't already been set by a sub-class during its render method.
}
- var annotated = <JsxParser
- components={{ FormattedTextBox: FormattedTextBox, ImageBox, CollectionFreeFormView, CollectionDockingView, CollectionSchemaView }}
- bindings={bindings}
- jsx={this.backgroundLayout}
- showWarnings={true}
- onError={(test: any) => { console.log(test) }}
- />;
- bindings["BackgroundView"] = this.backgroundLayout ? annotated : null;
+ if (this.backgroundLayout) {
+ var backgroundview = <JsxParser
+ components={{ FormattedTextBox: FormattedTextBox, ImageBox, CollectionFreeFormView, CollectionDockingView, CollectionSchemaView }}
+ bindings={bindings}
+ jsx={this.backgroundLayout}
+ showWarnings={true}
+ onError={(test: any) => { console.log(test) }}
+ />;
+ bindings["BackgroundView"] = backgroundview;
+ }
var nativewidth = this.props.Document.GetNumber(KeyStore.NativeWidth, 0);
var nativeheight = this.props.Document.GetNumber(KeyStore.NativeHeight, 0);
var width = nativewidth > 0 ? nativewidth + "px" : "100%";
var height = nativeheight > 0 ? nativeheight + "px" : "100%";
return (
- <div className="node" ref={this._mainCont} style={{ width: width, height: height, transformOrigin: "0 0", transform: `scale(${this.props.ParentScaling},${this.props.ParentScaling})` }}>
+ <div className="node" ref={this._mainCont}
+ style={{
+ width: width,
+ height: height,
+ transformOrigin: "top left",
+ transform: `scale(${this.props.ParentScaling},${this.props.ParentScaling})`
+ }}>
<JsxParser
components={{ FormattedTextBox: FormattedTextBox, ImageBox, CollectionFreeFormView, CollectionDockingView, CollectionSchemaView }}
bindings={bindings}