From 1c54fb50438698bbc7a533ff98102e2a41458017 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 5 Aug 2020 11:31:51 -0400 Subject: fixed scaling/nan issue when collection's are fitWidth but not nativeW/H --- src/client/views/collections/CollectionDockingView.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx index 533c8bffe..75a4bda14 100644 --- a/src/client/views/collections/CollectionDockingView.tsx +++ b/src/client/views/collections/CollectionDockingView.tsx @@ -793,10 +793,10 @@ export class DockedFrameRenderer extends React.Component { let scaling = 1; if (!this.layoutDoc?._fitWidth && (!nativeW || !nativeH)) { scaling = 1; - } else if ((this.layoutDoc?._fitWidth) || - this._panelHeight / NumCast(this.layoutDoc!._nativeHeight) > this._panelWidth / NumCast(this.layoutDoc!._nativeWidth)) { + } else if (NumCast(this.layoutDoc!._nativeWidth) && ((this.layoutDoc?._fitWidth) || + this._panelHeight / NumCast(this.layoutDoc!._nativeHeight) > this._panelWidth / NumCast(this.layoutDoc!._nativeWidth))) { scaling = this._panelWidth / NumCast(this.layoutDoc!._nativeWidth); - } else { + } else if (nativeW && nativeH) { // if (this.layoutDoc!.type === DocumentType.PDF || this.layoutDoc!.type === DocumentType.WEB) { // if ((this.layoutDoc?._fitWidth) || // this._panelHeight / NumCast(this.layoutDoc!._nativeHeight) > this._panelWidth / NumCast(this.layoutDoc!._nativeWidth)) { @@ -807,7 +807,7 @@ export class DockedFrameRenderer extends React.Component { // } const wscale = this.panelWidth() / nativeW; scaling = wscale * nativeH > this._panelHeight ? this._panelHeight / nativeH : wscale; - } + } else scaling = 1; return scaling; } -- cgit v1.2.3-70-g09d2 From ffa36a87eb1093883dcc80128b08d24d2440f75a Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 5 Aug 2020 13:01:52 -0400 Subject: fixed perfectly horizontal/vertical lines to display. make InkFields script editable. --- src/client/util/type_decls.d | 5 +++++ src/client/views/DocumentDecorations.tsx | 2 -- src/client/views/InkingStroke.tsx | 8 ++++---- src/fields/InkField.ts | 5 ++++- 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/client/util/type_decls.d b/src/client/util/type_decls.d index 08aec3724..ab6c94f83 100644 --- a/src/client/util/type_decls.d +++ b/src/client/util/type_decls.d @@ -187,6 +187,11 @@ declare class List extends ObjectField { [Copy](): ObjectField; } +declare class InkField extends ObjectField { + constructor(data:Array<{X:number, Y:number}>); + [Copy](): ObjectField; +} + // @ts-ignore declare const console: any; diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 1ae7d6617..005df6fe0 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -68,8 +68,6 @@ export class DocumentDecorations extends React.Component<{}, { value: string }> private _prevY = 0; private _centerPoints: { X: number, Y: number }[] = []; private _inkDocs: { x: number, y: number, width: number, height: number }[] = []; - private _natWid = 0; - private _natHei = 0; @observable private _accumulatedTitle = ""; @observable private _titleControlString: string = "#title"; diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx index fe5bf1eb2..6c5eda256 100644 --- a/src/client/views/InkingStroke.tsx +++ b/src/client/views/InkingStroke.tsx @@ -99,10 +99,10 @@ export class InkingStroke extends ViewBoxBaseComponent `{X: ${i.X}, Y: ${i.Y}} `) + "])"; } [ToString]() { return "InkField"; } } + +Scripting.addGlobal("InkField", InkField); \ No newline at end of file -- cgit v1.2.3-70-g09d2 From d3c49ce7b1921dec4c27f425b2af788e3d6385e9 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 5 Aug 2020 13:05:31 -0400 Subject: from last --- src/client/views/collections/collectionFreeForm/FormatShapePane.tsx | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx b/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx index d526033a0..6263be261 100644 --- a/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx +++ b/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx @@ -214,7 +214,6 @@ export default class FormatShapePane extends AntimodeMenu { @undoBatch @action control = (xDiff: number, yDiff: number, controlNum: number) => { - // console.log(controlNum, ink.length); this.selectedInk?.forEach(action(inkView => { if (this.selectedInk?.length === 1) { const doc = Document(inkView.rootDoc); @@ -222,7 +221,6 @@ export default class FormatShapePane extends AntimodeMenu { const ink = Cast(doc.data, InkField)?.inkData; if (ink) { - const newPoints: { X: number, Y: number }[] = []; const order = controlNum % 4; for (var i = 0; i < ink.length; i++) { -- cgit v1.2.3-70-g09d2