diff --git a/gui/src/components/onboarding/pages/mounting/MountingSelectionMenu.tsx b/gui/src/components/onboarding/pages/mounting/MountingSelectionMenu.tsx index d29dad03d..fa8f6dfba 100644 --- a/gui/src/components/onboarding/pages/mounting/MountingSelectionMenu.tsx +++ b/gui/src/components/onboarding/pages/mounting/MountingSelectionMenu.tsx @@ -1,12 +1,11 @@ import classNames from 'classnames'; -import { MouseEventHandler } from 'react'; import ReactModal from 'react-modal'; import { useElemSize, useLayout } from '@/hooks/layout'; import { Button } from '@/components/commons/Button'; import { Typography } from '@/components/commons/Typography'; import { useLocalization } from '@fluent/react'; import { FootIcon } from '@/components/commons/icon/FootIcon'; -import { rotationToQuatMap } from '@/maths/quaternion'; +import { rotationToQuatMap, similarQuaternions } from '@/maths/quaternion'; import { Quaternion } from 'three'; import { SlimeUpIcon } from '@/components/commons/icon/SlimeUpIcon'; import { BodyPart } from 'solarxr-protocol'; @@ -113,14 +112,18 @@ export function MountingBodyPartIcon({ } function PieSliceOfFeet({ - onClick, + direction, + onDirectionSelected, + currRotation, id, d, noText = false, trackerTransform, trackerWidth = 10, }: { - onClick?: MouseEventHandler; + direction: Quaternion; + onDirectionSelected: (direction: Quaternion) => void; + currRotation?: Quaternion; id: string; d: string; noText?: boolean; @@ -131,7 +134,7 @@ function PieSliceOfFeet({ return ( onDirectionSelected(direction)} className={classNames('group fill-background-10 stroke-background-10')} > @@ -163,11 +171,13 @@ export function MountingSelectionMenu({ onClose, onDirectionSelected, bodyPart, + currRotation, }: { isOpen: boolean; onClose: () => void; onDirectionSelected: (direction: Quaternion) => void; bodyPart?: BodyPart; + currRotation?: Quaternion; }) { const { l10n } = useLocalization(); const { ref: refTrackers, layoutHeight: trackersHeight } = @@ -209,31 +219,35 @@ export function MountingSelectionMenu({ onDirectionSelected(rotationToQuatMap.LEFT)} + direction={rotationToQuatMap.LEFT} + onDirectionSelected={onDirectionSelected} + currRotation={currRotation} id="tracker-rotation-left" trackerTransform="translate(75, 0) scale(-1, 1)" > - onDirectionSelected(rotationToQuatMap.FRONT_LEFT) - } + direction={rotationToQuatMap.FRONT_LEFT} + onDirectionSelected={onDirectionSelected} + currRotation={currRotation} id="tracker-rotation_left_front" noText={true} trackerTransform="translate(-2, 175) rotate(-135)" trackerWidth={7} > onDirectionSelected(rotationToQuatMap.FRONT)} d="M0 0-44-89A99 99 0 0 1 44-89Z" + direction={rotationToQuatMap.FRONT} + onDirectionSelected={onDirectionSelected} + currRotation={currRotation} id="tracker-rotation-front" trackerTransform="translate(0, 75) rotate(-90)" > - onDirectionSelected(rotationToQuatMap.FRONT_RIGHT) - } + direction={rotationToQuatMap.FRONT_RIGHT} + onDirectionSelected={onDirectionSelected} + currRotation={currRotation} id="tracker-rotation-front_right" noText={true} trackerTransform="translate(73, 0) rotate(-45)" @@ -241,15 +255,17 @@ export function MountingSelectionMenu({ > onDirectionSelected(rotationToQuatMap.RIGHT)} + direction={rotationToQuatMap.RIGHT} + onDirectionSelected={onDirectionSelected} + currRotation={currRotation} id="tracker-rotation-right" trackerTransform="translate(175,0)" > - onDirectionSelected(rotationToQuatMap.BACK_RIGHT) - } + direction={rotationToQuatMap.BACK_RIGHT} + onDirectionSelected={onDirectionSelected} + currRotation={currRotation} id="tracker-rotation-back_right" noText={true} trackerTransform="translate(252, 75) rotate(45)" @@ -257,15 +273,17 @@ export function MountingSelectionMenu({ > onDirectionSelected(rotationToQuatMap.BACK)} + direction={rotationToQuatMap.BACK} + onDirectionSelected={onDirectionSelected} + currRotation={currRotation} id="tracker-rotation-back" trackerTransform="translate(250, 175) rotate(90)" > - onDirectionSelected(rotationToQuatMap.BACK_LEFT) - } + direction={rotationToQuatMap.BACK_LEFT} + onDirectionSelected={onDirectionSelected} + currRotation={currRotation} id="tracker-rotation-back_left" noText={true} trackerTransform="translate(177, 250) rotate(135)" diff --git a/gui/src/components/tracker/TrackerSettings.tsx b/gui/src/components/tracker/TrackerSettings.tsx index f2c316219..e74ed22fe 100644 --- a/gui/src/components/tracker/TrackerSettings.tsx +++ b/gui/src/components/tracker/TrackerSettings.tsx @@ -170,6 +170,7 @@ export function TrackerSettingsPage() { > setSelectRotation(false)} onDirectionSelected={onDirectionSelected}