aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkingStroke.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/InkingStroke.tsx')
-rw-r--r--src/client/views/InkingStroke.tsx26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx
index a27f106e3..7cee84fc5 100644
--- a/src/client/views/InkingStroke.tsx
+++ b/src/client/views/InkingStroke.tsx
@@ -14,7 +14,7 @@ type InkDocument = makeInterface<[typeof documentSchema]>;
const InkDocument = makeInterface(documentSchema);
export function CreatePolyline(points: { x: number, y: number }[], left: number, top: number, color?: string, width?: number) {
- let pts = points.reduce((acc: string, pt: { x: number, y: number }) => acc + `${pt.x - left},${pt.y - top} `, "");
+ const pts = points.reduce((acc: string, pt: { x: number, y: number }) => acc + `${pt.x - left},${pt.y - top} `, "");
return (
<polyline
points={pts}
@@ -35,18 +35,18 @@ export class InkingStroke extends DocExtendableComponent<FieldViewProps, InkDocu
@computed get PanelHeight() { return this.props.PanelHeight(); }
render() {
- let data: InkData = Cast(this.Document.data, InkField)?.inkData ?? [];
- let xs = data.map(p => p.x);
- let ys = data.map(p => p.y);
- let left = Math.min(...xs);
- let top = Math.min(...ys);
- let right = Math.max(...xs);
- let bottom = Math.max(...ys);
- let points = CreatePolyline(data, 0, 0, this.Document.color, this.Document.strokeWidth);
- let width = right - left;
- let height = bottom - top;
- let scaleX = this.PanelWidth / width;
- let scaleY = this.PanelHeight / height;
+ const data: InkData = Cast(this.Document.data, InkField)?.inkData ?? [];
+ const xs = data.map(p => p.x);
+ const ys = data.map(p => p.y);
+ const left = Math.min(...xs);
+ const top = Math.min(...ys);
+ const right = Math.max(...xs);
+ const bottom = Math.max(...ys);
+ const points = CreatePolyline(data, 0, 0, this.Document.color, this.Document.strokeWidth);
+ const width = right - left;
+ const height = bottom - top;
+ const scaleX = this.PanelWidth / width;
+ const scaleY = this.PanelHeight / height;
return (
<svg width={width} height={height} style={{
transformOrigin: "top left",