Fix console errors when hovering a locked door alert that belongs to a door on a different scene
This commit is contained in:
8
main.js
8
main.js
@@ -22,13 +22,17 @@ Hooks.on("renderChatMessage", (message, html, data) => {
|
|||||||
|
|
||||||
// Tint on mouse enter
|
// Tint on mouse enter
|
||||||
const mouseEnter = function () {
|
const mouseEnter = function () {
|
||||||
canvas.controls.doors.children.find(door => door.wall.data._id == sourceId).icon.tint = 0xff0000;
|
const sourceDoor = canvas.controls.doors.children.find(door => door.wall.data._id == sourceId);
|
||||||
|
if (sourceDoor)
|
||||||
|
sourceDoor.icon.tint = 0xff0000;
|
||||||
}
|
}
|
||||||
html.on("mouseenter", mouseEnter);
|
html.on("mouseenter", mouseEnter);
|
||||||
|
|
||||||
// Remove tint on mouse leave
|
// Remove tint on mouse leave
|
||||||
const mouseLeave = function () {
|
const mouseLeave = function () {
|
||||||
canvas.controls.doors.children.find(door => door.wall.data._id == sourceId).icon.tint = 0xffffff;
|
const sourceDoor = canvas.controls.doors.children.find(door => door.wall.data._id == sourceId);
|
||||||
|
if (sourceDoor)
|
||||||
|
sourceDoor.icon.tint = 0xffffff;
|
||||||
}
|
}
|
||||||
html.on("mouseleave", mouseLeave);
|
html.on("mouseleave", mouseLeave);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user