aboutsummaryrefslogtreecommitdiff
path: root/web/app/controller/Root.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-03-15 09:38:12 +0500
committerAbyss777 <abyss@fox5.ru>2017-03-15 09:38:12 +0500
commitb93d36f154d6e5b16769ddec07bb8936512f8bb1 (patch)
treedc62fa48dd2e8df692aa56a6ee626693ef0ceee6 /web/app/controller/Root.js
parentd77cc1c9b2890224119d59b493597e47e3f1792f (diff)
downloadetbsa-traccar-web-b93d36f154d6e5b16769ddec07bb8936512f8bb1.tar.gz
etbsa-traccar-web-b93d36f154d6e5b16769ddec07bb8936512f8bb1.tar.bz2
etbsa-traccar-web-b93d36f154d6e5b16769ddec07bb8936512f8bb1.zip
Zoom to all devices on launch
Diffstat (limited to 'web/app/controller/Root.js')
-rw-r--r--web/app/controller/Root.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index 404fb7c..94f0705 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -167,6 +167,9 @@ Ext.define('Traccar.controller.Root', {
self.updateEvents(data.events);
}
};
+ if (first) {
+ this.first = true;
+ }
},
updateDevices: function (array) {
@@ -196,6 +199,10 @@ Ext.define('Traccar.controller.Root', {
store.add(Ext.create('Traccar.model.Position', array[i]));
}
}
+ if (this.first) {
+ this.zoomToAllDevices();
+ this.first = false;
+ }
},
updateEvents: function (array) {
@@ -225,5 +232,15 @@ Ext.define('Traccar.controller.Root', {
Ext.toast(text, device.get('name'), 'br');
}
}
+ },
+
+ zoomToAllDevices: function () {
+ var lat, lon, zoom;
+ lat = Traccar.app.getPreference('latitude', 0);
+ lon = Traccar.app.getPreference('longitude', 0);
+ zoom = Traccar.app.getPreference('zoom', 0);
+ if (lat === 0 && lon === 0 && zoom === 0) {
+ this.fireEvent('zoomtoalldevices');
+ }
}
});