forked from angular-ui/angular-google-maps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-controller.js
More file actions
115 lines (107 loc) · 3.74 KB
/
debug-controller.js
File metadata and controls
115 lines (107 loc) · 3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
(function () {
var module = angular.module("angular-google-maps-example", ["google-maps"]);
}());
var rndAddToLatLon = function () {
return Math.floor(((Math.random() < 0.5 ? -1 : 1) * 2) + 1)
}
function DebugController($scope, $timeout, $log, $http) {
// Enable the new Google Maps visuals until it gets enabled by default.
// See http://googlegeodevelopers.blogspot.ca/2013/05/a-fresh-new-look-for-maps-api-for-all.html
google.maps.visualRefresh = true;
versionUrl = window.location.host === "rawgithub.com" ? "http://rawgithub.com/nlaplante/angular-google-maps/master/package.json" : "/package.json";
$http.get(versionUrl).success(function (data) {
if (!data)
console.error("no version object found!!");
$scope.version = data.version;
});
angular.extend($scope, {
map: {
control: {},
center: {
latitude: 45,
longitude: -74
},
marker: {
latitude: 45,
longitude: -74,
options: {
visible: false
}
},
marker2: {
latitude: 45.2,
longitude: -74.5
},
// dragging:false, //appears to be required
zoom: 7,
options: {
disableDefaultUI: true,
panControl: false,
navigationControl: false,
scrollwheel: false,
scaleControl: false
},
refresh: function () {
$scope.map.control.refresh(origCenter);
}
},
map2: {
control: {},
center: {
latitude: 52.2,
longitude: -80
},
showMap:true,
marker: {
latitude: 70,
longitude: -76,
options: {
visible: true
}
},
marker2: {
latitude: 50.2,
longitude: -80.5
},
zoom: 4,
refresh: function () {
$scope.map2.control.refresh({latitude: 32.779680, longitude: -79.935493});
$scope.map2.showMap = false;
_.defer(function(){
$scope.map2.showMap = true;
});
},
markers3: [
{
id: 1,
time: "12:00PM",
coords: {
latitude: 52.2,
longitude: -80.5
},
icon: "plane.png",
lastSignal: "Never",
click:function(){
this.show = true;
this.lastSignal = Math.round(Date.now()).toString();
$scope.apply();
},
closeClick:function(){
this.showWindow = false;
},
show:false
}
],
onMarkerClick: function (m) {
m.lastSignal = Math.round(Date.now()).toString();
m.show = true;
$scope.map2.markers3.length = 0;
// _defer to allow the directive to clean up all old markers and windows
// since we know it is only the one marker just wipe and replace
// otherwise find it in the array or have a hashmap to array index to get it quick
_.defer(function(){$scope.map2.markers3 = [m];$scope.$apply();});
}
}
});
var origCenter = {latitude: $scope.map.center.latitude, longitude: $scope.map.center.longitude};
}