From bc07ecbf1f8bb616b81dab0c51933bfd9528622b Mon Sep 17 00:00:00 2001 From: tetreum Date: Thu, 8 Dec 2022 19:20:08 +0100 Subject: [PATCH 1/2] + Avatar - onStopWalkingCallback --- src/objects/avatar/Avatar.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/objects/avatar/Avatar.ts b/src/objects/avatar/Avatar.ts index 6420a85..de701fc 100644 --- a/src/objects/avatar/Avatar.ts +++ b/src/objects/avatar/Avatar.ts @@ -46,6 +46,7 @@ export class Avatar extends RoomObject implements IMoveable, IScreenPositioned { private _onPointerUp: HitEventHandler | undefined = undefined; private _onPointerOver: HitEventHandler | undefined = undefined; private _onPointerOut: HitEventHandler | undefined = undefined; + private _onStopWalkingCallback: (() => void) | undefined = undefined; constructor({ look, @@ -606,6 +607,14 @@ export class Avatar extends RoomObject implements IMoveable, IScreenPositioned { private _stopWalking() { this._walking = false; this._updateAvatarSprites(); + + if (this._onStopWalkingCallback) { + this._onStopWalkingCallback(); + } + } + + public set onStopWalkingCallback(value: (() => void) | undefined) { + this._onStopWalkingCallback = value; } private _calculateZIndex() { From 2e99d867f2eb8e73678d35f863f5717c9d40d2f9 Mon Sep 17 00:00:00 2001 From: tetreum Date: Tue, 13 Dec 2022 18:12:06 +0100 Subject: [PATCH 2/2] + Avatar - onStopMovementCallback --- src/objects/avatar/Avatar.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/objects/avatar/Avatar.ts b/src/objects/avatar/Avatar.ts index de701fc..b04399d 100644 --- a/src/objects/avatar/Avatar.ts +++ b/src/objects/avatar/Avatar.ts @@ -46,7 +46,7 @@ export class Avatar extends RoomObject implements IMoveable, IScreenPositioned { private _onPointerUp: HitEventHandler | undefined = undefined; private _onPointerOver: HitEventHandler | undefined = undefined; private _onPointerOut: HitEventHandler | undefined = undefined; - private _onStopWalkingCallback: (() => void) | undefined = undefined; + private _onStopMovementCallback: (() => void) | undefined = undefined; constructor({ look, @@ -428,6 +428,10 @@ export class Avatar extends RoomObject implements IMoveable, IScreenPositioned { onStop: () => { this._stopWalking(); this._moving = false; + + if (this._onStopMovementCallback) { + this._onStopMovementCallback(); + } }, }, this.configuration.avatarMovementDuration @@ -607,14 +611,10 @@ export class Avatar extends RoomObject implements IMoveable, IScreenPositioned { private _stopWalking() { this._walking = false; this._updateAvatarSprites(); - - if (this._onStopWalkingCallback) { - this._onStopWalkingCallback(); - } } - public set onStopWalkingCallback(value: (() => void) | undefined) { - this._onStopWalkingCallback = value; + public set onStopMovementCallback(value: (() => void) | undefined) { + this._onStopMovementCallback = value; } private _calculateZIndex() {