1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Fixed rooms not getting brought to the front sometimes

This commit is contained in:
Jon Ziebell 2022-08-05 11:52:04 -04:00
parent cc19594bf5
commit c2006a7975
3 changed files with 17 additions and 7 deletions

View File

@ -163,12 +163,22 @@ beestat.component.card.floor_plan_editor.prototype.decorate_drawing_pane_ = func
// Activate the currently active room (mostly for rerenders).
if (room === self.state_.active_room) {
room_entity.set_active(true);
}
} else {
// Render the room and save to the list of current entities.
room_entity.render(self.floor_plan_.get_g());
self.entities_.room.push(room_entity);
}
});
/**
* If there was an active room, defer to adding it last so it ends up on
* top. The set_active function doesn't do anything if the room isn't
* rendered otherwise.
*/
if (this.state_.active_room_entity !== undefined) {
this.state_.active_room_entity.render(this.floor_plan_.get_g());
this.entities_.room.push(this.state_.active_room_entity);
}
};
/**

View File

@ -81,7 +81,7 @@ beestat.component.floor_plan_entity.prototype.rerender = function() {
/**
* Bring the current element to the front.
*/
beestat.component.floor_plan_entity.prototype.bring_to_front = function() {
beestat.component.floor_plan_entity.prototype.bring_to_front_ = function() {
if (this.rendered_ === true) {
this.g_.parentNode.appendChild(this.g_);
}

View File

@ -256,9 +256,9 @@ beestat.component.floor_plan_entity.room.prototype.set_active = function(active)
this.dispatchEvent('activate');
this.update_snap_points_();
this.bring_to_front();
this.bring_to_front_();
} else {
// throw 'foo';
delete this.state_.active_room;
delete this.state_.active_room_entity;