Initial commit

This commit is contained in:
Juho Teperi
2013-05-13 11:43:34 +03:00
commit fbf8fb087a
44 changed files with 2425 additions and 0 deletions

41
app/scripts/views/map.js Normal file
View File

@@ -0,0 +1,41 @@
'use strict';
define([
'backbone',
'libs/maps'
], function (Backbone, Maps) {
var MapView = Backbone.View.extend({
el: '#gmap',
initialize: function () {
this.collection.on('sort', this.render, this);
this.collection.on('remove', this.render, this);
this.collection.on('add', this.add, this);
this.map = new Maps.Map(this.el);
this.route = new Maps.Line({
geodesic: true,
map: this.map,
strokeColor: '#000'
});
this.bounds = new Maps.Bounds(this.map);
},
render: function () {
this.route.clear();
this.bounds.clear();
this.collection.forEach(this.route.add);
this.collection.forEach(this.bounds.add);
this.bounds.use();
},
add: function (model, collection, options) {
this.route.add(model);
this.bounds.add(model);
this.bounds.use();
}
});
return MapView;
});