Skip to content

Commit

Permalink
feat: udpate code (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
cptbtptpbcptdtptp authored Jan 15, 2025
1 parent e3ad603 commit de3097d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/navigation-gizmo/src/SphereScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
MathUtil,
Matrix,
Pointer,
PointerEventData,
Quaternion,
Ray,
Script,
Expand Down Expand Up @@ -115,15 +116,15 @@ export class SphereScript extends Script {
}
}

override onPointerDown(pointer: Pointer) {
override onPointerDown(eventData: PointerEventData) {
this._disableComponent();
this._recoverTextColor();

// get targetPoint
SphereScript._startPos.copyFrom(this._sceneCameraEntity.transform.worldPosition);

SphereScript._startQuat.copyFrom(this._directionEntity.transform.worldRotationQuaternion);
SphereScript._startPointer.copyFrom(pointer.position);
SphereScript._startPointer.copyFrom(eventData.pointer.position);

this._tempUpVec.copyFrom(this._sceneCameraEntity.transform.worldUp);
this._isBack = this._tempUpVec.y <= 0;
Expand All @@ -141,16 +142,16 @@ export class SphereScript extends Script {
}

this._isTriggered = true;
this._navigateCamera(pointer);
this._navigateCamera(eventData.pointer);
}

override onPointerDrag(pointer: Pointer) {
this._navigateCamera(pointer);
override onPointerDrag(eventData: PointerEventData) {
this._navigateCamera(eventData.pointer);
}

override onPointerUp(pointer: Pointer) {
override onPointerUp(eventData: PointerEventData) {
if (this._isTriggered) {
this._gizmoCamera.screenPointToRay(pointer.position, this._ray);
this._gizmoCamera.screenPointToRay(eventData.pointer.position, this._ray);
const result = this.engine.physicsManager.raycast(this._ray, Number.MAX_VALUE, Layer.Everything);
if (!result) {
this._roundEntity.isActive = false;
Expand Down

0 comments on commit de3097d

Please sign in to comment.