aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/util/type_decls.d5
-rw-r--r--src/client/views/DocumentDecorations.tsx2
-rw-r--r--src/client/views/InkingStroke.tsx8
3 files changed, 9 insertions, 6 deletions
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<T extends Field> 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<FieldViewProps, InkDocume
const top = Math.min(...ys) - strokeWidth / 2;
const right = Math.max(...xs) + strokeWidth / 2;
const bottom = Math.max(...ys) + strokeWidth / 2;
- const width = right - left;
- const height = bottom - top;
- const scaleX = (this.props.PanelWidth() - strokeWidth) / (width - strokeWidth);
- const scaleY = (this.props.PanelHeight() - strokeWidth) / (height - strokeWidth);
+ const width = Math.max(right - left);
+ const height = Math.max(1, bottom - top);
+ const scaleX = width === strokeWidth ? 1 : (this.props.PanelWidth() - strokeWidth) / (width - strokeWidth);
+ const scaleY = height === strokeWidth ? 1 : (this.props.PanelHeight() - strokeWidth) / (height - strokeWidth);
const strokeColor = StrCast(this.layoutDoc.color, "");
const points = InteractionUtils.CreatePolyline(data, left, top, strokeColor, strokeWidth, strokeWidth,