After combining different code snippets, I have successfully created a circular slider component that functions as a slideable control dial with a defined maximum angle. However, I am now seeking more flexibility by wanting to specify a custom start angle. This would allow me to create dials similar to car dashboard controls. The images below demonstrate my attempt at implementing this feature, which unfortunately disrupts the touch handling:
https://i.sstatic.net/SyRAZ.gif
I am currently encapsulating an SVG component within a view to achieve this functionality, rotating the container view and appropriately adjusting text rotation values. Here is a TypeScript snippet of the component:
(component code here)
The current implementation of the component is done using the following parameters:
<CircularSlider rotationOffset={-135} maxAngle={270} onValueChange={(angle) => angle } />
. (Or without the offset for the first GIF example).
In attempting to handle touch events while compensating for the rotation of the container view, I have experimented with various approaches like adjusting the current angle before inputting into PolarToCartesian(), utilizing different measurement methods, and altering the way parameters are passed. However, none of these solutions provided the desired behavior.
I am looking for guidance on how to effectively compensate for the rotation of the container view in touch handling or if there is an alternative approach that can achieve the required functionality. (Developed using React Native 0.57.0 and react-native-svg ^7.0.2).