diff --git a/js/Item.js b/js/Item.js index 6b32dd7..0452ce4 100644 --- a/js/Item.js +++ b/js/Item.js @@ -436,8 +436,11 @@ export class Item { this.hoverIndicator.scale.set(desiredScale, desiredScale, desiredScale); // Counteract the parent's scale by dividing the indicator's scale by the parent's scale. - if (this.object.scale.x !== 0 && this.object.scale.y !== 0 && this.object.scale.z !== 0) { - this.hoverIndicator.scale.divide(this.object.scale); + if (scale.x !== 0 && scale.y !== 0 && scale.z !== 0) { + this.hoverIndicator.scale.divide(scale); + } else { + // Avoid division by zero + this.hoverIndicator.scale.set(1, 1, 1); } // Position the sprite at the center of the object, in local space.