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

Fixed floor plans not centering on first load.

This commit is contained in:
Jon Ziebell 2022-08-09 19:47:58 -04:00
parent 81168bb7f0
commit 6736326f20
3 changed files with 6 additions and 6 deletions

View File

@ -59,7 +59,7 @@
"sort-keys": "off",
"space-before-function-paren": ["error", "never"],
"strict": "off",
"valid-jsdoc": ["error", {"requireReturn": false, "requireParamDescription": false}],
"valid-jsdoc": ["error", {"requireReturn": false, "requireParamDescription": false, "requireReturnDescription": false}],
"vars-on-top": "off",
"operator_assignment": "off",

View File

@ -5,6 +5,7 @@
*/
beestat.component.card.floor_plan_editor = function(thermostat_id) {
const self = this;
this.thermostat_id_ = thermostat_id;
var change_function = beestat.debounce(function() {
@ -36,12 +37,12 @@ beestat.component.card.floor_plan_editor = function(thermostat_id) {
}
// The first time this component renders center the content.
if (self.floor_plan_ !== undefined) {
this.addEventListener('render', function() {
if (this.floor_plan_ !== undefined) {
self.floor_plan_.center_content();
self.removeEventListener('render');
});
}
});
};
beestat.extend(beestat.component.card.floor_plan_editor, beestat.component.card);

View File

@ -943,7 +943,6 @@ beestat.component.floor_plan.prototype.get_group_below = function(group) {
* Center the view box on the content. Sets zoom and pan.
*/
beestat.component.floor_plan.prototype.center_content = function() {
window.fp = this;
const floor_plan = beestat.cache.floor_plan[this.floor_plan_id_];
let min_x = Infinity;