aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkingStroke.tsx
diff options
context:
space:
mode:
authoryunahi <60233430+yunahi@users.noreply.github.com>2020-08-10 22:49:50 +0900
committeryunahi <60233430+yunahi@users.noreply.github.com>2020-08-10 22:49:50 +0900
commit01ebdb0db657f4c9de7959d2810548993a26e675 (patch)
tree7f6146cf0818984546fd319bb375870ccd260bf9 /src/client/views/InkingStroke.tsx
parentd4ca38801b19e38b49b087be3e510cc0fca33eb8 (diff)
parentd3c49ce7b1921dec4c27f425b2af788e3d6385e9 (diff)
Merge branch 'ink_edits' of https://github.com/browngraphicslab/Dash-Web into ink_edits
:wq
Diffstat (limited to 'src/client/views/InkingStroke.tsx')
-rw-r--r--src/client/views/InkingStroke.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx
index 0afc71e9b..f0505ed95 100644
--- a/src/client/views/InkingStroke.tsx
+++ b/src/client/views/InkingStroke.tsx
@@ -107,10 +107,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,