From 790817a6bf0656f78f980a9f7808ddd1ee161197 Mon Sep 17 00:00:00 2001 From: elmarti Date: Thu, 24 Nov 2022 17:55:30 +0000 Subject: [PATCH] :bug: fix sticky end position --- src/Joystick.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Joystick.tsx b/src/Joystick.tsx index 818e721..afedaf5 100644 --- a/src/Joystick.tsx +++ b/src/Joystick.tsx @@ -294,9 +294,9 @@ class Joystick extends React.Component { this.props.stop({ type: "stop", // @ts-ignore - x: this.props.sticky ? this.state.coordinates.relativeX : null, + x: this.props.sticky ? ((this.state.coordinates.relativeX * 2) / this._baseSize) : null, // @ts-ignore - y: this.props.sticky ? this.state.coordinates.relativeY : null, + y: this.props.sticky ? ((this.state.coordinates.relativeY * 2) / this._baseSize): null, // @ts-ignore direction: this.props.sticky ? this.state.coordinates.direction : null, // @ts-ignore