-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(track,core): support clockwise orientation in circular track #1078
base: main
Are you sure you want to change the base?
Conversation
export function valueToRadian(v: number, max: number, sa: number, ea: number, clockwise?: boolean) { | ||
const safeVal = Math.max(Math.min(max, v), 0); | ||
const gap = g ?? RADIAN_GAP; | ||
const gap = RADIAN_GAP; | ||
const radExtent = ((ea - sa) / 360) * Math.PI * 2 - gap * 2; | ||
const radStart = (sa / 360) * Math.PI * 2; | ||
return -(radStart + (safeVal / max) * radExtent) - Math.PI / 2.0 - gap; | ||
const result = -(radStart + (safeVal / max) * radExtent) - Math.PI / 2.0 - gap; | ||
|
||
if (clockwise) { | ||
return -result - Math.PI; | ||
} | ||
return result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main strategy is to add a "clockwise" option to to the radian calculation
@@ -4,21 +4,35 @@ export const RADIAN_GAP = 0; //0.04; | |||
* Convert a value in a single-linear axis to a radian value. Anticlockwise, starts from 12 o'clock. | |||
* v span from zero to `max`. | |||
*/ | |||
export function valueToRadian(v: number, max: number, sa: number, ea: number, g?: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
g?: number
option was not used anywhere so got rid of it
TODO: fix the clockwise brush |
Fix #280
Toward #
Change List
clockwise
option to circular tracks to change the orientation.Makes changes to axis, brush, and marks
Clockwise:
Not clockwise:
Example of clockwise axis
Checklist