From 7c40769da5a7e908cdff4a5ee31df93af16c5ccf Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Sat, 14 Feb 2026 00:26:16 -0500 Subject: [PATCH] Center --- js/component/scene.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/js/component/scene.js b/js/component/scene.js index ceb8ab2..0db0da8 100644 --- a/js/component/scene.js +++ b/js/component/scene.js @@ -102,7 +102,7 @@ beestat.component.scene.prototype.decorate_ = function(parent) { this.debug_ = { 'axes': true, - 'directional_light_helpers': true, + 'directional_light_helpers': false, 'sun_light_helper': true, 'moon_light_helper': true, 'watcher': true, @@ -1147,10 +1147,18 @@ beestat.component.scene.prototype.update_debug_ = function() { */ beestat.component.scene.prototype.add_main_group_ = function() { const bounding_box = beestat.floor_plan.get_bounding_box(this.floor_plan_id_); + console.info(bounding_box); // Main group handles rotation, orientation, and centering this.main_group_ = new THREE.Group(); + // Center the floor plan at origin (accounting for bounding box offset) + this.main_group_.position.set( + (bounding_box.right + bounding_box.left) / -2, + 0, + (bounding_box.bottom + bounding_box.top) / -2 + ); + // Apply X rotation to orient the floor plan this.main_group_.rotation.x = Math.PI / 2; @@ -1158,10 +1166,6 @@ beestat.component.scene.prototype.add_main_group_ = function() { const rotation_degrees = this.get_appearance_value_('rotation'); this.main_group_.rotation.z = (rotation_degrees * Math.PI) / 180; - // Apply translation to center the geometry at the rotation point - this.main_group_.translateX((bounding_box.right + bounding_box.left) / -2); - this.main_group_.translateZ((bounding_box.bottom + bounding_box.top) / -2); - this.scene_.add(this.main_group_); };