Skip to content

Commit

Permalink
fix:eslint problem
Browse files Browse the repository at this point in the history
  • Loading branch information
oahc09 committed Sep 21, 2023
1 parent a749c17 commit a079fd1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
38 changes: 21 additions & 17 deletions pal/input/native/handle-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ enum StickKeyCode {
START,
TRIGGER_LEFT,
TRIGGER_RIGHT,
};
}

enum StickAxisCode {
UNDEFINE = 0,
Expand All @@ -98,7 +98,7 @@ enum StickAxisCode {
RIGHT_TRIGGER,
LEFT_THUMBSTICK,
RIGHT_THUMBSTICK,
};
}

interface IPoseValue {
position: Vec3;
Expand Down Expand Up @@ -246,7 +246,7 @@ export class HandleInputDevice {
[Pose.HAND_RIGHT]: { position: Vec3.ZERO, orientation: Quat.IDENTITY },
[Pose.AIM_LEFT]: { position: Vec3.ZERO, orientation: Quat.IDENTITY },
[Pose.AIM_RIGHT]: { position: Vec3.ZERO, orientation: Quat.IDENTITY },
}
};

constructor () {
this._initInputSource();
Expand Down Expand Up @@ -357,20 +357,24 @@ export class HandleInputDevice {

private _updateNativePoseState (info: jsb.PoseInfo): void {
switch (info.code) {
case 1:
this._nativePoseState[Pose.HAND_LEFT] = { position: new Vec3(info.x, info.y, info.z), orientation: new Quat(info.quaternionX, info.quaternionY, info.quaternionZ, info.quaternionW) };
break;
case 2:
this._nativePoseState[Pose.AIM_LEFT] = { position: new Vec3(info.x, info.y, info.z), orientation: new Quat(info.quaternionX, info.quaternionY, info.quaternionZ, info.quaternionW) };
break;
case 4:
this._nativePoseState[Pose.HAND_RIGHT] = { position: new Vec3(info.x, info.y, info.z), orientation: new Quat(info.quaternionX, info.quaternionY, info.quaternionZ, info.quaternionW) };
break;
case 5:
this._nativePoseState[Pose.AIM_RIGHT] = { position: new Vec3(info.x, info.y, info.z), orientation: new Quat(info.quaternionX, info.quaternionY, info.quaternionZ, info.quaternionW) };
break;
default:
break;
case 1:
this._nativePoseState[Pose.HAND_LEFT] = { position: new Vec3(info.x, info.y, info.z),
orientation: new Quat(info.quaternionX, info.quaternionY, info.quaternionZ, info.quaternionW) };
break;
case 2:
this._nativePoseState[Pose.AIM_LEFT] = { position: new Vec3(info.x, info.y, info.z),
orientation: new Quat(info.quaternionX, info.quaternionY, info.quaternionZ, info.quaternionW) };
break;
case 4:
this._nativePoseState[Pose.HAND_RIGHT] = { position: new Vec3(info.x, info.y, info.z),
orientation: new Quat(info.quaternionX, info.quaternionY, info.quaternionZ, info.quaternionW) };
break;
case 5:
this._nativePoseState[Pose.AIM_RIGHT] = { position: new Vec3(info.x, info.y, info.z),
orientation: new Quat(info.quaternionX, info.quaternionY, info.quaternionZ, info.quaternionW) };
break;
default:
break;
}
}

Expand Down
12 changes: 6 additions & 6 deletions pal/input/web/handle-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ enum StickKeyCode {
START,
TRIGGER_LEFT,
TRIGGER_RIGHT,
};
}

enum StickAxisCode {
UNDEFINE = 0,
Expand All @@ -96,7 +96,7 @@ enum StickAxisCode {
RIGHT_TRIGGER,
LEFT_THUMBSTICK,
RIGHT_THUMBSTICK,
};
}

const _nativeButtonMap = {
1: Button.BUTTON_EAST,
Expand Down Expand Up @@ -238,9 +238,9 @@ export class HandleInputDevice {
window.addEventListener('xr-remote-input', (evt: Event): void => {
const remoteInputEvent: CustomEvent = evt as CustomEvent;
const keyEventType: KeyEventType = remoteInputEvent.detail.keyEventType;
const stickAxisCode = remoteInputEvent.detail.stickAxisCode;
const stickAxisValue = remoteInputEvent.detail.stickAxisValue;
const stickKeyCode = remoteInputEvent.detail.stickKeyCode;
const stickAxisCode = remoteInputEvent.detail.stickAxisCode as StickAxisCode;
const stickAxisValue = remoteInputEvent.detail.stickAxisValue as number;
const stickKeyCode = remoteInputEvent.detail.stickKeyCode as number;
const isButtonPressed = remoteInputEvent.detail.isButtonPressed;

if (keyEventType === KeyEventType.KET_CLICK) {
Expand Down Expand Up @@ -293,7 +293,7 @@ export class HandleInputDevice {
case StickAxisCode.LEFT_THUMBSTICK:
case StickAxisCode.RIGHT_THUMBSTICK:
this._nativeTouchState[stickAxisCode] = stickAxisValue;
break;
break;
default:
break;
}
Expand Down

0 comments on commit a079fd1

Please sign in to comment.