aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/GestureOverlay.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-08-08 12:27:40 -0400
committerbobzel <zzzman@gmail.com>2024-08-08 12:27:40 -0400
commit4574b7f03ccc85c4bebdbfd9475788456086704f (patch)
treed23d30343541b9af029ef418492d629d3cc710d7 /src/client/views/GestureOverlay.tsx
parente1db06d59d580aa640212a0d3a6aeecb9122bdf0 (diff)
many changes to add typing in place of 'any's etc
Diffstat (limited to 'src/client/views/GestureOverlay.tsx')
-rw-r--r--src/client/views/GestureOverlay.tsx26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx
index e3e252593..804c41091 100644
--- a/src/client/views/GestureOverlay.tsx
+++ b/src/client/views/GestureOverlay.tsx
@@ -78,7 +78,7 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
private thumbIdentifier?: number;
private pointerIdentifier?: number;
- constructor(props: any) {
+ constructor(props: GestureOverlayProps) {
super(props);
makeObservable(this);
GestureOverlay.Instances.push(this);
@@ -94,7 +94,7 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
@action
onPointerDown = (e: React.PointerEvent) => {
- if (!(e.target as any)?.className?.toString().startsWith('lm_')) {
+ if (!(e.target as HTMLElement)?.className?.toString().startsWith('lm_')) {
if ([InkTool.Highlighter, InkTool.Pen, InkTool.Write].includes(Doc.ActiveTool)) {
this._points.push({ X: e.clientX, Y: e.clientY });
setupMoveUpEvents(this, e, this.onPointerMove, this.onPointerUp, emptyFunction);
@@ -173,8 +173,8 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
newPoints.pop();
const controlPoints: { X: number; Y: number }[] = [];
- const bezierCurves = (fitCurve as any)(newPoints, 10);
- Array.from(bezierCurves).forEach((curve: any) => {
+ const bezierCurves = fitCurve.default(newPoints, 10);
+ Array.from(bezierCurves).forEach(curve => {
controlPoints.push({ X: curve[0][0], Y: curve[0][1] });
controlPoints.push({ X: curve[1][0], Y: curve[1][1] });
controlPoints.push({ X: curve[2][0], Y: curve[2][1] });
@@ -351,7 +351,7 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
return false;
};
- dispatchGesture = (gesture: Gestures, stroke?: InkData, text?: any) => {
+ dispatchGesture = (gesture: Gestures, stroke?: InkData, text?: string) => {
const points = (stroke ?? this._points).slice();
return (
document.elementFromPoint(points[0].X, points[0].Y)?.dispatchEvent(
@@ -411,7 +411,7 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
ActiveDash(),
1,
1,
- this.InkShape ?? '',
+ this.InkShape as Gestures,
'none',
1.0,
false
@@ -438,7 +438,7 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
ActiveDash(),
1,
1,
- this.InkShape ?? '',
+ this.InkShape as Gestures,
'none',
1.0,
false
@@ -516,13 +516,7 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
ScriptingGlobals.add('GestureOverlay', GestureOverlay);
// eslint-disable-next-line prefer-arrow-callback
-ScriptingGlobals.add(function setToolglass(tool: any) {
- runInAction(() => {
- GestureOverlay.Instance.Tool = tool;
- });
-});
-// eslint-disable-next-line prefer-arrow-callback
-ScriptingGlobals.add(function setPen(width: any, color: any, fill: any, arrowStart: any, arrowEnd: any, dash: any) {
+ScriptingGlobals.add(function setPen(width: string, color: string, fill: string, arrowStart: string, arrowEnd: string, dash: string) {
runInAction(() => {
GestureOverlay.Instance.SavedColor = ActiveInkColor();
SetActiveInkColor(color);
@@ -543,8 +537,8 @@ ScriptingGlobals.add(function resetPen() {
}, 'resets the pen tool');
ScriptingGlobals.add(
// eslint-disable-next-line prefer-arrow-callback
- function createText(text: any, x: any, y: any) {
- GestureOverlay.Instance.dispatchGesture(Gestures.Text, [{ X: x, Y: y }], text);
+ function createText(text: string, X: number, Y: number) {
+ GestureOverlay.Instance.dispatchGesture(Gestures.Text, [{ X, Y }], text);
},
'creates a text document with inputted text and coordinates',
'(text: any, x: any, y: any)'