Skip to content

Commit

Permalink
Fix bug in AnimatedFurnitureVisualization
Browse files Browse the repository at this point in the history
  • Loading branch information
jankuss committed Jan 23, 2021
1 parent fff3b27 commit 58775a5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/objects/furniture/BaseFurniture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,11 @@ export class BaseFurniture implements IFurnitureEventHandlers {

public set animation(value) {
this._animation = value;
this.visualization.updateAnimation(this.animation);
this._handleAnimationChange();

if (this.mounted) {
this.visualization.updateAnimation(this.animation);
this._handleAnimationChange();
}
}

public get maskId() {
Expand Down Expand Up @@ -344,6 +347,8 @@ export class BaseFurniture implements IFurnitureEventHandlers {
};

private _updateDirection() {
if (!this.mounted) return;

if (this._validDirections != null) {
this.visualization.updateDirection(
getDirectionForFurniture(this.direction, this._validDirections)
Expand Down
10 changes: 10 additions & 0 deletions storybook/stories/Furniture.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ export function Animated() {
}
};

if (i === 0) {
room.onActiveTileChange.subscribe((value) => {
if (value == null) return;

furniture.roomX = value.roomX;
furniture.roomY = value.roomY;
furniture.roomZ = value.roomZ;
});
}

room.addRoomObject(furniture);
}

Expand Down
2 changes: 2 additions & 0 deletions storybook/stories/Issues.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ export function IssueWithAvatarEventsNotHandled() {

avatar.onDoubleClick = (event) => {
event.stopPropagation();

action("Avatar Double Clicked")(event);
};

furniture.onClick = (event) => {
Expand Down

0 comments on commit 58775a5

Please sign in to comment.