plotboilerplate 1.12.9 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +5 -1
  2. package/changelog.md +34 -0
  3. package/dist/index.esm.js +435 -92
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.esm.min.js +1 -1
  6. package/dist/index.esm.min.js.map +1 -1
  7. package/dist/plotboilerplate.browser.min.js +1 -1
  8. package/dist/plotboilerplate.browser.min.js.map +1 -1
  9. package/dist/plotboilerplate.js +449 -91
  10. package/dist/plotboilerplate.min.js +1 -1
  11. package/package.json +1 -1
  12. package/src/cjs/BezierPath.d.ts +12 -1
  13. package/src/cjs/BezierPath.js +34 -5
  14. package/src/cjs/BezierPath.js.map +1 -1
  15. package/src/cjs/PBText.d.ts +116 -0
  16. package/src/cjs/PBText.js +66 -0
  17. package/src/cjs/PBText.js.map +1 -0
  18. package/src/cjs/PlotBoilerplate.d.ts +2 -1
  19. package/src/cjs/PlotBoilerplate.js +43 -15
  20. package/src/cjs/PlotBoilerplate.js.map +1 -1
  21. package/src/cjs/Polygon.d.ts +22 -1
  22. package/src/cjs/Polygon.js +102 -39
  23. package/src/cjs/Polygon.js.map +1 -1
  24. package/src/cjs/Vertex.d.ts +42 -4
  25. package/src/cjs/Vertex.js +62 -7
  26. package/src/cjs/Vertex.js.map +1 -1
  27. package/src/cjs/draw.d.ts +30 -2
  28. package/src/cjs/draw.js +51 -6
  29. package/src/cjs/draw.js.map +1 -1
  30. package/src/cjs/drawgl.d.ts +29 -2
  31. package/src/cjs/drawgl.js +21 -4
  32. package/src/cjs/drawgl.js.map +1 -1
  33. package/src/cjs/drawutilssvg.d.ts +25 -7
  34. package/src/cjs/drawutilssvg.js +62 -14
  35. package/src/cjs/drawutilssvg.js.map +1 -1
  36. package/src/cjs/entry.js +1 -0
  37. package/src/cjs/index.d.ts +1 -0
  38. package/src/cjs/index.js +1 -0
  39. package/src/cjs/index.js.map +1 -1
  40. package/src/cjs/interfaces/DrawLib.d.ts +27 -6
  41. package/src/cjs/interfaces/DrawLib.js +3 -0
  42. package/src/cjs/interfaces/DrawLib.js.map +1 -1
  43. package/src/cjs/interfaces/core.d.ts +9 -1
  44. package/src/cjs/interfaces/core.js +1 -0
  45. package/src/cjs/interfaces/core.js.map +1 -1
  46. package/src/cjs/utils/datastructures/Color.d.ts +28 -15
  47. package/src/cjs/utils/datastructures/Color.js +276 -88
  48. package/src/cjs/utils/datastructures/Color.js.map +1 -1
  49. package/src/cjs/utils/findInVertexArray.d.ts +19 -0
  50. package/src/cjs/utils/findInVertexArray.js +29 -0
  51. package/src/cjs/utils/findInVertexArray.js.map +1 -0
  52. package/src/esm/BezierPath.d.ts +12 -1
  53. package/src/esm/BezierPath.js +34 -5
  54. package/src/esm/BezierPath.js.map +1 -1
  55. package/src/esm/PBText.d.ts +116 -0
  56. package/src/esm/PBText.js +61 -0
  57. package/src/esm/PBText.js.map +1 -0
  58. package/src/esm/PlotBoilerplate.d.ts +2 -1
  59. package/src/esm/PlotBoilerplate.js +43 -15
  60. package/src/esm/PlotBoilerplate.js.map +1 -1
  61. package/src/esm/Polygon.d.ts +22 -1
  62. package/src/esm/Polygon.js +102 -39
  63. package/src/esm/Polygon.js.map +1 -1
  64. package/src/esm/Vertex.d.ts +42 -4
  65. package/src/esm/Vertex.js +62 -7
  66. package/src/esm/Vertex.js.map +1 -1
  67. package/src/esm/draw.d.ts +30 -2
  68. package/src/esm/draw.js +51 -6
  69. package/src/esm/draw.js.map +1 -1
  70. package/src/esm/drawgl.d.ts +29 -2
  71. package/src/esm/drawgl.js +21 -4
  72. package/src/esm/drawgl.js.map +1 -1
  73. package/src/esm/drawutilssvg.d.ts +25 -7
  74. package/src/esm/drawutilssvg.js +62 -14
  75. package/src/esm/drawutilssvg.js.map +1 -1
  76. package/src/esm/entry.js +1 -0
  77. package/src/esm/index.d.ts +1 -0
  78. package/src/esm/index.js +1 -0
  79. package/src/esm/index.js.map +1 -1
  80. package/src/esm/interfaces/DrawLib.d.ts +27 -6
  81. package/src/esm/interfaces/DrawLib.js +3 -0
  82. package/src/esm/interfaces/DrawLib.js.map +1 -1
  83. package/src/esm/interfaces/core.d.ts +9 -1
  84. package/src/esm/interfaces/core.js +1 -0
  85. package/src/esm/interfaces/core.js.map +1 -1
  86. package/src/esm/utils/datastructures/Color.d.ts +28 -15
  87. package/src/esm/utils/datastructures/Color.js +277 -89
  88. package/src/esm/utils/datastructures/Color.js.map +1 -1
  89. package/src/esm/utils/findInVertexArray.d.ts +19 -0
  90. package/src/esm/utils/findInVertexArray.js +25 -0
  91. package/src/esm/utils/findInVertexArray.js.map +1 -0
  92. package/src/ts/BezierPath.ts +37 -5
  93. package/src/ts/PBText.ts +147 -0
  94. package/src/ts/PlotBoilerplate.ts +47 -19
  95. package/src/ts/Polygon.ts +493 -451
  96. package/src/ts/Vertex.ts +66 -7
  97. package/src/ts/draw.ts +71 -8
  98. package/src/ts/drawgl.ts +48 -8
  99. package/src/ts/drawutilssvg.ts +94 -17
  100. package/src/ts/index.ts +1 -0
  101. package/src/ts/interfaces/DrawLib.ts +30 -4
  102. package/src/ts/interfaces/core.ts +9 -0
  103. package/src/ts/utils/datastructures/Color.ts +695 -508
  104. package/src/ts/utils/findInVertexArray.ts +28 -0
  105. package/dist/plotboilerplate.browser.min.js.LICENSE.txt +0 -8
  106. package/src/ts/utils/algorithms/clearPolygonDuplicateVertices.ts~ +0 -5
  107. package/src/ts/utils/algorithms/findPolygonSelfIntersections.ts~ +0 -45
  108. package/src/ts/utils/algorithms/sh-tmp.ts~ +0 -59
  109. package/src/ts/utils/algorithms/splitPolygonToNonIntersecting.ts~ +0 -113
  110. package/src/ts/utils/algorithms/sutherlandHodgman.ts~ +0 -88
  111. package/src/ts/utils/datastructures/Color.ts~ +0 -331
  112. package/src/ts/utils/datastructures/Girih.ts~ +0 -151
  113. package/src/ts/utils/datastructures/GirihTile.ts~ +0 -419
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @author Ikaros Kappler
3
+ * @date 2022-01-10
4
+ * @version 1.0.0
5
+ */
6
+ /**
7
+ * In an array of vertices find the first occurence of a specific vertex, using
8
+ * and epsilon tolerance.
9
+ *
10
+ * @param {Array<Vertex>} vertexList - The vertex array to search in.
11
+ * @param {XYCoords} vertex - A vertex/position to search for. This can be any x-y-tuple and does not
12
+ * necessarily need to be an instance of Vertex.
13
+ * @param {number} epsilon - The epsilon tolerance to use (should be >= 0). This is a required param to avoid excessive
14
+ * is-undef checking if this function runs in a loop.
15
+ * @returns {boolean} - The first index of a vertex that matched or -1 if no such vertex could be found.
16
+ */
17
+ export const findInVertexArray = (vertexList, vertex, epsilon) => {
18
+ for (var i = 0; i < vertexList.length; i++) {
19
+ if (vertexList[i].distance(vertex) < epsilon) {
20
+ return i;
21
+ }
22
+ }
23
+ return -1;
24
+ };
25
+ //# sourceMappingURL=findInVertexArray.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findInVertexArray.js","sourceRoot":"","sources":["../../ts/utils/findInVertexArray.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,UAAyB,EAAE,MAAgB,EAAE,OAAe,EAAU,EAAE;IACxG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,EAAE;YAC5C,OAAO,CAAC,CAAC;SACV;KACF;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC,CAAC"}
@@ -529,6 +529,38 @@ export class BezierPath implements SVGSerializable {
529
529
  return this;
530
530
  }
531
531
 
532
+ /**
533
+ * Scale the whole bezier path by the given uniform factor.
534
+ *
535
+ * @method scale
536
+ * @param {Vertex} anchor - The scale origin to scale from.
537
+ * @param {number} scaleFactor - The scalar to be multiplied with.
538
+ * @instance
539
+ * @memberof BezierPath
540
+ * @return {BezierPath} this for chaining.
541
+ **/
542
+ scale(anchor: Vertex, scaleFactor: number): BezierPath {
543
+ // var scaleFactors : XYCoords = { x : scaleFactor, y : scaleFactor };
544
+ // for (var i = 0; i < this.bezierCurves.length; i++) {
545
+ // var curve = this.bezierCurves[i];
546
+ // curve.getStartPoint().scale(scaleFactor, anchor);
547
+ // curve.getStartControlPoint().scale(scaleFactor, anchor);
548
+ // curve.getEndControlPoint().scale(scaleFactor, anchor);
549
+ // // Do NOT scale the end point here!
550
+ // // Don't forget that the curves are connected and on curve's end point
551
+ // // the the successor's start point (same instance)!
552
+ // }
553
+
554
+ // // Finally move the last end point (was not scaled yet)
555
+ // if (this.bezierCurves.length > 0 && !this.adjustCircular) {
556
+ // this.bezierCurves[this.bezierCurves.length - 1].getEndPoint().scale(scaleFactor, anchor);
557
+ // }
558
+
559
+ // this.updateArcLengths();
560
+ // return this;
561
+ return this.scaleXY({ x: scaleFactor, y: scaleFactor }, anchor);
562
+ }
563
+
532
564
  /**
533
565
  * Scale the whole bezier path by the given (x,y)-factors.
534
566
  *
@@ -539,12 +571,12 @@ export class BezierPath implements SVGSerializable {
539
571
  * @memberof BezierPath
540
572
  * @return {BezierPath} this for chaining.
541
573
  **/
542
- scale(anchor: Vertex, scaling: number): BezierPath {
574
+ scaleXY(scaleFactors: XYCoords, anchor?: XYCoords): BezierPath {
543
575
  for (var i = 0; i < this.bezierCurves.length; i++) {
544
576
  var curve = this.bezierCurves[i];
545
- curve.getStartPoint().scale(scaling, anchor);
546
- curve.getStartControlPoint().scale(scaling, anchor);
547
- curve.getEndControlPoint().scale(scaling, anchor);
577
+ curve.getStartPoint().scaleXY(scaleFactors, anchor);
578
+ curve.getStartControlPoint().scaleXY(scaleFactors, anchor);
579
+ curve.getEndControlPoint().scaleXY(scaleFactors, anchor);
548
580
  // Do NOT scale the end point here!
549
581
  // Don't forget that the curves are connected and on curve's end point
550
582
  // the the successor's start point (same instance)!
@@ -552,7 +584,7 @@ export class BezierPath implements SVGSerializable {
552
584
 
553
585
  // Finally move the last end point (was not scaled yet)
554
586
  if (this.bezierCurves.length > 0 && !this.adjustCircular) {
555
- this.bezierCurves[this.bezierCurves.length - 1].getEndPoint().scale(scaling, anchor);
587
+ this.bezierCurves[this.bezierCurves.length - 1].getEndPoint().scaleXY(scaleFactors, anchor);
556
588
  }
557
589
 
558
590
  this.updateArcLengths();
@@ -0,0 +1,147 @@
1
+ /**
2
+ * @author Ikaros Kappler
3
+ * @date 2021-11-16
4
+ * @version 1.0.0
5
+ **/
6
+
7
+ import { UIDGenerator } from "./UIDGenerator";
8
+ import { Vertex } from "./Vertex";
9
+ import { FontOptions, FontStyle, FontWeight, SVGSerializable, UID } from "./interfaces";
10
+
11
+ /**
12
+ * @classdesc A simple text element: position, fontSize, fontFamily, color, textAlign, lineHeight and rotation.
13
+ *
14
+ * @requires FontOptions
15
+ * @requires FontSize
16
+ * @requires FontStyle
17
+ * @requires FontWeight
18
+ * @requires Vertex
19
+ * @requires SVGSerializale
20
+ * @requires UID
21
+ * @requires UIDGenerator
22
+ **/
23
+ export class PBText implements SVGSerializable, FontOptions {
24
+ /**
25
+ * Required to generate proper CSS classes and other class related IDs.
26
+ **/
27
+ readonly className: string = "PBText";
28
+
29
+ /**
30
+ * The UID of this drawable object.
31
+ *
32
+ * @member {UID}
33
+ * @memberof PBText
34
+ * @instance
35
+ * @readonly
36
+ */
37
+ readonly uid: UID;
38
+
39
+ /**
40
+ * @member {string}
41
+ * @memberof PBText
42
+ * @instance
43
+ */
44
+ text: string;
45
+
46
+ /**
47
+ * @member {Vertex}
48
+ * @memberof PBText
49
+ * @instance
50
+ */
51
+ anchor: Vertex;
52
+
53
+ /**
54
+ * @member {number}
55
+ * @memberof PBText
56
+ * @instance
57
+ */
58
+ fontSize: number | undefined;
59
+
60
+ /**
61
+ * @member {number}
62
+ * @memberof PBText
63
+ * @instance
64
+ */
65
+ lineHeight: number | undefined;
66
+
67
+ /**
68
+ * @member {FontWeight}
69
+ * @memberof PBText
70
+ * @instance
71
+ */
72
+ fontWeight: FontWeight | undefined;
73
+
74
+ /**
75
+ * @member {FontStyle}
76
+ * @memberof PBText
77
+ * @instance
78
+ */
79
+ fontStyle: FontStyle | undefined;
80
+
81
+ /**
82
+ * @member {CanvasRenderingContext2D["textAlign"]}
83
+ * @memberof PBText
84
+ * @instance
85
+ */
86
+ textAlign: CanvasRenderingContext2D["textAlign"] | undefined;
87
+
88
+ /**
89
+ * @member {number}
90
+ * @memberof PBText
91
+ * @instance
92
+ */
93
+ rotation: number | undefined;
94
+
95
+ /**
96
+ * @member {number}
97
+ * @memberof PBText
98
+ * @instance
99
+ */
100
+ fontFamily: string | undefined;
101
+
102
+ /**
103
+ * @member {number}
104
+ * @memberof PBText
105
+ * @instance
106
+ */
107
+ color: string | undefined;
108
+
109
+ /**
110
+ * Create a new circle with given center point and radius.
111
+ *
112
+ * @constructor
113
+ * @name Circle
114
+ * @param {Vertex} center - The center point of the circle.
115
+ * @param {number} radius - The radius of the circle.
116
+ */
117
+ constructor(text: string, anchor?: Vertex, options?: FontOptions) {
118
+ this.uid = UIDGenerator.next();
119
+ this.text = text;
120
+ this.anchor = anchor ?? new Vertex();
121
+ this.color = options.color;
122
+ this.fontFamily = options.fontFamily;
123
+ this.fontSize = options.fontSize;
124
+ this.fontStyle = options.fontStyle;
125
+ this.fontWeight = options.fontWeight;
126
+ this.lineHeight = options.lineHeight;
127
+ this.textAlign = options.textAlign;
128
+ this.rotation = options.rotation;
129
+ }
130
+
131
+ /**
132
+ * Create an SVG representation of this circle.
133
+ *
134
+ * @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.
135
+ * @method toSVGString
136
+ * @param {object=} options - An optional set of options, like 'className'.
137
+ * @return {string} A string representing the SVG code for this vertex.
138
+ * @instance
139
+ * @memberof Circle
140
+ */
141
+ toSVGString(options: { className?: string }) {
142
+ console.warn(
143
+ "[PBText.toSVGString()] This function is not implemented as it defines a deprecated method. Use the 'drawutilssvg.text()' method instead."
144
+ );
145
+ return "";
146
+ }
147
+ } // END class
@@ -73,7 +73,8 @@
73
73
  * @modified 2021-03-03 Added the `VEllipseSector` drawable.
74
74
  * @modified 2021-03-29 Clearing `currentClassName` and `currentId` after drawing each drawable.
75
75
  * @modified 2021-04-25 Extending `remove` to accept arrays of drawables.
76
- * @version 1.14.0
76
+ * @modified 2021-11-16 Adding the `PBText` drawable.
77
+ * @version 1.15.0
77
78
  *
78
79
  * @file PlotBoilerplate
79
80
  * @fileoverview The main class.
@@ -118,6 +119,8 @@ import {
118
119
  XYDimension,
119
120
  DatGuiProps
120
121
  } from "./interfaces";
122
+ import { PBText } from "./PBText";
123
+ import { AlloyFingerOptions } from "alloyfinger-typescript/src/cjs/alloy_finger";
121
124
 
122
125
  /**
123
126
  * @classdesc The main class of the PlotBoilerplate.
@@ -521,6 +524,12 @@ export class PlotBoilerplate {
521
524
  image: {
522
525
  color: "#a8a8a8",
523
526
  lineWidth: 1
527
+ },
528
+ text: {
529
+ color: "rgba(192,0,128,0.5)",
530
+ lineWidth: 1,
531
+ fill: true,
532
+ anchor: true
524
533
  }
525
534
  }; // END drawConfig
526
535
 
@@ -656,7 +665,7 @@ export class PlotBoilerplate {
656
665
  var blob = new Blob([svgCode], { type: "image/svg;charset=utf-8" });
657
666
  // See documentation for FileSaver.js for usage.
658
667
  // https://github.com/eligrey/FileSaver.js
659
- if (typeof globalThis["saveAs"] != "function")
668
+ if (typeof globalThis["saveAs"] !== "function")
660
669
  throw "Cannot save file; did you load the ./utils/savefile helper function and the eligrey/SaveFile library?";
661
670
  var _saveAs = globalThis["saveAs"];
662
671
  _saveAs(blob, "plotboilerplate.svg");
@@ -768,7 +777,6 @@ export class PlotBoilerplate {
768
777
  add(drawable: Drawable | Array<Drawable>, redraw?: boolean) {
769
778
  if (Array.isArray(drawable)) {
770
779
  const arr: Array<Drawable> = drawable as Array<Drawable>;
771
- // for( var i in arr )
772
780
  for (var i = 0; i < arr.length; i++) {
773
781
  this.add(arr[i], false);
774
782
  }
@@ -806,8 +814,9 @@ export class PlotBoilerplate {
806
814
  this.drawables.push(drawable);
807
815
  } else if (drawable instanceof Polygon) {
808
816
  this.drawables.push(drawable);
809
- // for( var i in drawable.vertices )
810
- for (var i = 0; i < drawable.vertices.length; i++) this.vertices.push(drawable.vertices[i]);
817
+ for (var i = 0; i < drawable.vertices.length; i++) {
818
+ this.vertices.push(drawable.vertices[i]);
819
+ }
811
820
  } else if (drawable instanceof Triangle) {
812
821
  this.drawables.push(drawable);
813
822
  this.vertices.push(drawable.a);
@@ -817,7 +826,9 @@ export class PlotBoilerplate {
817
826
  this.drawables.push(drawable);
818
827
  const bezierPath: BezierPath = drawable as BezierPath;
819
828
  for (var i = 0; i < bezierPath.bezierCurves.length; i++) {
820
- if (!drawable.adjustCircular && i == 0) this.vertices.push(bezierPath.bezierCurves[i].startPoint);
829
+ if (!drawable.adjustCircular && i == 0) {
830
+ this.vertices.push(bezierPath.bezierCurves[i].startPoint);
831
+ }
821
832
  this.vertices.push(bezierPath.bezierCurves[i].endPoint);
822
833
  this.vertices.push(bezierPath.bezierCurves[i].startControlPoint);
823
834
  this.vertices.push(bezierPath.bezierCurves[i].endControlPoint);
@@ -834,6 +845,10 @@ export class PlotBoilerplate {
834
845
  drawable.lowerRight.add(e.params.dragAmount);
835
846
  });
836
847
  drawable.lowerRight.attr.selectable = false;
848
+ } else if (drawable instanceof PBText) {
849
+ this.vertices.push(drawable.anchor);
850
+ this.drawables.push(drawable);
851
+ drawable.anchor.attr.selectable = false;
837
852
  } else {
838
853
  throw "Cannot add drawable of unrecognized type: " + typeof drawable + ".";
839
854
  }
@@ -923,6 +938,8 @@ export class PlotBoilerplate {
923
938
  } else if (drawable instanceof PBImage) {
924
939
  this.removeVertex(drawable.upperLeft, false);
925
940
  this.removeVertex(drawable.lowerRight, false);
941
+ } else if (drawable instanceof PBText) {
942
+ this.removeVertex(drawable.anchor, false);
926
943
  }
927
944
  } // END removeWithVertices
928
945
 
@@ -947,7 +964,9 @@ export class PlotBoilerplate {
947
964
  for (var i = 0; i < this.vertices.length; i++) {
948
965
  if (this.vertices[i] === vert) {
949
966
  this.vertices.splice(i, 1);
950
- if (redraw) this.redraw();
967
+ if (redraw) {
968
+ this.redraw();
969
+ }
951
970
  return;
952
971
  }
953
972
  }
@@ -987,7 +1006,9 @@ export class PlotBoilerplate {
987
1006
  this.transformMousePosition(pixelPosition.x, pixelPosition.y),
988
1007
  pixelTolerance / Math.min(this.config.cssScaleX, this.config.cssScaleY)
989
1008
  );
990
- if (p && p.typeName == "vertex") return this.vertices[p.vindex];
1009
+ if (p && p.typeName == "vertex") {
1010
+ return this.vertices[p.vindex];
1011
+ }
991
1012
  return undefined;
992
1013
  }
993
1014
 
@@ -1320,6 +1341,15 @@ export class PlotBoilerplate {
1320
1341
  draw.circleHandle(d.lowerRight, 3, this.drawConfig.image.color);
1321
1342
  d.lowerRight.attr.renderTime = renderTime;
1322
1343
  }
1344
+ } else if (d instanceof PBText) {
1345
+ fill.setCurrentId(d.uid);
1346
+ fill.text(d.text, d.anchor.x, d.anchor.y, d);
1347
+ if (this.drawConfig.text.anchor) {
1348
+ draw.setCurrentId(`${d.uid}_a0`);
1349
+ draw.setCurrentClassName(`${d.className}-anchor`);
1350
+ (this.drawConfig.text.fill ? fill : draw).point(d.anchor, this.drawConfig.text.color);
1351
+ }
1352
+ d.anchor.attr.renderTime = renderTime;
1323
1353
  } else {
1324
1354
  console.error("Cannot draw object. Unknown class.");
1325
1355
  }
@@ -1617,7 +1647,6 @@ export class PlotBoilerplate {
1617
1647
  // Apply the zoom (the tolerant area should not shrink or grow when zooming)
1618
1648
  tolerance /= _self.draw.scale.x;
1619
1649
  // Search in vertices
1620
- // for( var vindex in _self.vertices ) {
1621
1650
  for (var vindex = 0; vindex < _self.vertices.length; vindex++) {
1622
1651
  var vert: Vertex = _self.vertices[vindex];
1623
1652
  if ((vert.attr.draggable || vert.attr.selectable) && vert.distance(point) < tolerance) {
@@ -1638,10 +1667,7 @@ export class PlotBoilerplate {
1638
1667
  * @return {void}
1639
1668
  **/
1640
1669
  private handleClick(e: XMouseEvent) {
1641
- // x:number,y:number) {
1642
1670
  const _self: PlotBoilerplate = this;
1643
- // const x:number = e.params.pos.x;
1644
- //const y:number = e.params.pos.y;
1645
1671
  var p: IDraggable = this.locatePointNear(
1646
1672
  _self.transformMousePosition(e.params.pos.x, e.params.pos.y),
1647
1673
  PlotBoilerplate.DEFAULT_CLICK_TOLERANCE / Math.min(_self.config.cssScaleX, _self.config.cssScaleY)
@@ -1657,9 +1683,7 @@ export class PlotBoilerplate {
1657
1683
  if (vert.attr.selectable) vert.attr.isSelected = !vert.attr.isSelected;
1658
1684
  }
1659
1685
  _self.redraw();
1660
- } else if (
1661
- this.keyHandler.isDown("y") /* && p.type=='bpath' && (p.pid==BezierPath.START_POINT || p.pid==BezierPath.END_POINT) */
1662
- ) {
1686
+ } else if (this.keyHandler.isDown("y")) {
1663
1687
  _self.vertices[p.vindex].attr.bezierAutoAdjust = !_self.vertices[p.vindex].attr.bezierAutoAdjust;
1664
1688
  _self.redraw();
1665
1689
  }
@@ -1961,7 +1985,8 @@ export class PlotBoilerplate {
1961
1985
  multiTouchStartScale = null;
1962
1986
  _self.draggedElements = [];
1963
1987
  };
1964
- const afProps = {
1988
+ const afProps: AlloyFingerOptions = {
1989
+ // touchStart: (evt: TouchEvent) => {
1965
1990
  touchStart: (evt: TouchEvent) => {
1966
1991
  if (evt.touches.length == 1) {
1967
1992
  touchMovePos = new Vertex(relPos({ x: evt.touches[0].clientX, y: evt.touches[0].clientY }));
@@ -2065,10 +2090,13 @@ export class PlotBoilerplate {
2065
2090
  _self.setZoom(multiTouchStartScale.x * evt.zoom, multiTouchStartScale.y * evt.zoom, center);
2066
2091
  _self.redraw();
2067
2092
  }
2068
- }; // END afProps
2069
- if (window["createAlloyFinger"])
2093
+ } as unknown as AlloyFingerOptions; // END afProps
2094
+ if (window["createAlloyFinger"]) {
2070
2095
  window["createAlloyFinger"](this.eventCatcher ? this.eventCatcher : this.canvas, afProps);
2071
- else new AlloyFinger(this.eventCatcher ? this.eventCatcher : this.canvas, afProps);
2096
+ } else {
2097
+ /* tslint:disable-next-line */
2098
+ new AlloyFinger(this.eventCatcher ? this.eventCatcher : this.canvas, afProps);
2099
+ }
2072
2100
  } catch (e) {
2073
2101
  console.error("Failed to initialize AlloyFinger!");
2074
2102
  console.error(e);