gmapsjs 0.4.12 → 0.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/gmapsjs/gmapsjs.js +87 -23
- data/lib/gmapsjs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8b359e813a7ebcf253690c132ff3cf368f13662
|
4
|
+
data.tar.gz: e18a21de7f15af974c952f47b2d93db41e2f486d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b58bb6ec5dad864e31e629bea1473be44bc86592ce8fe9da2dca3db300182838d0f2b733895f5ac73ca7f0d775820699c6b2ff6e8cd7d40ca4ab9649efbee0b
|
7
|
+
data.tar.gz: 9fdfed750adebbf152953dc27309405c499359ad856bd3ed33877dac860ff44c5077542a9b4f843370e4f149143671b49d8444eef452e7890b703b9605964a82
|
@@ -11,7 +11,7 @@
|
|
11
11
|
}(this, function() {
|
12
12
|
|
13
13
|
/*!
|
14
|
-
* GMaps.js v0.4.
|
14
|
+
* GMaps.js v0.4.16
|
15
15
|
* http://hpneo.github.com/gmaps/
|
16
16
|
*
|
17
17
|
* Copyright 2014, Gustavo Leon
|
@@ -104,11 +104,13 @@ var arrayToLatLng = function(coords, useGeoJSON) {
|
|
104
104
|
var i;
|
105
105
|
|
106
106
|
for (i = 0; i < coords.length; i++) {
|
107
|
-
if (
|
108
|
-
coords[i]
|
109
|
-
|
110
|
-
|
111
|
-
|
107
|
+
if (!(coords[i] instanceof google.maps.LatLng)) {
|
108
|
+
if (coords[i].length > 0 && typeof(coords[i][0]) == "object") {
|
109
|
+
coords[i] = arrayToLatLng(coords[i], useGeoJSON);
|
110
|
+
}
|
111
|
+
else {
|
112
|
+
coords[i] = coordsToLatLngs(coords[i], useGeoJSON);
|
113
|
+
}
|
112
114
|
}
|
113
115
|
}
|
114
116
|
|
@@ -374,6 +376,9 @@ var GMaps = (function(global) {
|
|
374
376
|
});
|
375
377
|
};
|
376
378
|
|
379
|
+
//google.maps.event.addListener(this.map, 'idle', this.hideContextMenu);
|
380
|
+
google.maps.event.addListener(this.map, 'zoom_changed', this.hideContextMenu);
|
381
|
+
|
377
382
|
for (var ev = 0; ev < events_that_hide_context_menu.length; ev++) {
|
378
383
|
var name = events_that_hide_context_menu[ev];
|
379
384
|
|
@@ -500,7 +505,16 @@ GMaps.prototype.createControl = function(options) {
|
|
500
505
|
}
|
501
506
|
|
502
507
|
if (options.content) {
|
503
|
-
|
508
|
+
if (typeof options.content === 'string') {
|
509
|
+
control.innerHTML = options.content;
|
510
|
+
}
|
511
|
+
else if (options.content instanceof HTMLElement) {
|
512
|
+
control.appendChild(options.content);
|
513
|
+
}
|
514
|
+
}
|
515
|
+
|
516
|
+
if (options.position) {
|
517
|
+
control.position = google.maps.ControlPosition[options.position.toUpperCase()];
|
504
518
|
}
|
505
519
|
|
506
520
|
for (var ev in options.events) {
|
@@ -517,14 +531,32 @@ GMaps.prototype.createControl = function(options) {
|
|
517
531
|
};
|
518
532
|
|
519
533
|
GMaps.prototype.addControl = function(options) {
|
520
|
-
var position = google.maps.ControlPosition[options.position.toUpperCase()];
|
521
|
-
|
522
|
-
delete options.position;
|
523
|
-
|
524
534
|
var control = this.createControl(options);
|
525
535
|
this.controls.push(control);
|
526
|
-
|
527
|
-
|
536
|
+
this.map.controls[control.position].push(control);
|
537
|
+
|
538
|
+
return control;
|
539
|
+
};
|
540
|
+
|
541
|
+
GMaps.prototype.removeControl = function(control) {
|
542
|
+
var position = null;
|
543
|
+
|
544
|
+
for (var i = 0; i < this.controls.length; i++) {
|
545
|
+
if (this.controls[i] == control) {
|
546
|
+
position = this.controls[i].position;
|
547
|
+
this.controls.splice(i, 1);
|
548
|
+
}
|
549
|
+
}
|
550
|
+
|
551
|
+
if (position) {
|
552
|
+
for (i = 0; i < this.map.controls.length; i++) {
|
553
|
+
var controlsForPosition = this.map.controls[control.position]
|
554
|
+
if (controlsForPosition.getAt(i) == control) {
|
555
|
+
controlsForPosition.removeAt(i);
|
556
|
+
break;
|
557
|
+
}
|
558
|
+
}
|
559
|
+
}
|
528
560
|
|
529
561
|
return control;
|
530
562
|
};
|
@@ -701,21 +733,38 @@ GMaps.prototype.removeMarkers = function (collection) {
|
|
701
733
|
|
702
734
|
if (typeof collection == 'undefined') {
|
703
735
|
for (var i = 0; i < this.markers.length; i++) {
|
704
|
-
this.markers[i]
|
736
|
+
var marker = this.markers[i];
|
737
|
+
marker.setMap(null);
|
738
|
+
|
739
|
+
if(this.markerClusterer) {
|
740
|
+
this.markerClusterer.removeMarker(marker);
|
741
|
+
}
|
742
|
+
|
743
|
+
GMaps.fire('marker_removed', marker, this);
|
705
744
|
}
|
706
745
|
|
707
746
|
this.markers = new_markers;
|
708
747
|
}
|
709
748
|
else {
|
710
749
|
for (var i = 0; i < collection.length; i++) {
|
711
|
-
|
712
|
-
|
750
|
+
var index = this.markers.indexOf(collection[i]);
|
751
|
+
|
752
|
+
if (index > -1) {
|
753
|
+
var marker = this.markers[index];
|
754
|
+
marker.setMap(null);
|
755
|
+
|
756
|
+
if(this.markerClusterer) {
|
757
|
+
this.markerClusterer.removeMarker(marker);
|
758
|
+
}
|
759
|
+
|
760
|
+
GMaps.fire('marker_removed', marker, this);
|
713
761
|
}
|
714
762
|
}
|
715
763
|
|
716
764
|
for (var i = 0; i < this.markers.length; i++) {
|
717
|
-
|
718
|
-
|
765
|
+
var marker = this.markers[i];
|
766
|
+
if (marker.getMap() != null) {
|
767
|
+
new_markers.push(marker);
|
719
768
|
}
|
720
769
|
}
|
721
770
|
|
@@ -769,6 +818,7 @@ GMaps.prototype.drawOverlay = function(options) {
|
|
769
818
|
}
|
770
819
|
|
771
820
|
if (options.click) {
|
821
|
+
panes.overlayMouseTarget.appendChild(overlay.el);
|
772
822
|
google.maps.event.addDomListener(overlay.el, 'click', function() {
|
773
823
|
options.click.apply(overlay, [overlay]);
|
774
824
|
});
|
@@ -1369,6 +1419,7 @@ GMaps.prototype.travelRoute = function(options) {
|
|
1369
1419
|
destination: options.destination,
|
1370
1420
|
travelMode: options.travelMode,
|
1371
1421
|
waypoints : options.waypoints,
|
1422
|
+
unitSystem: options.unitSystem,
|
1372
1423
|
error: options.error,
|
1373
1424
|
callback: function(e) {
|
1374
1425
|
//start callback
|
@@ -1702,12 +1753,12 @@ GMaps.staticMapURL = function(options){
|
|
1702
1753
|
if (styles) {
|
1703
1754
|
for (var i = 0; i < styles.length; i++) {
|
1704
1755
|
var styleRule = [];
|
1705
|
-
if (styles[i].featureType
|
1706
|
-
styleRule.push('feature:' + styles[i].featureType);
|
1756
|
+
if (styles[i].featureType){
|
1757
|
+
styleRule.push('feature:' + styles[i].featureType.toLowerCase());
|
1707
1758
|
}
|
1708
1759
|
|
1709
|
-
if (styles[i].elementType
|
1710
|
-
styleRule.push('element:' + styles[i].elementType);
|
1760
|
+
if (styles[i].elementType) {
|
1761
|
+
styleRule.push('element:' + styles[i].elementType.toLowerCase());
|
1711
1762
|
}
|
1712
1763
|
|
1713
1764
|
for (var j = 0; j < styles[i].stylers.length; j++) {
|
@@ -1886,6 +1937,7 @@ GMaps.custom_events = ['marker_added', 'marker_removed', 'polyline_added', 'poly
|
|
1886
1937
|
|
1887
1938
|
GMaps.on = function(event_name, object, handler) {
|
1888
1939
|
if (GMaps.custom_events.indexOf(event_name) == -1) {
|
1940
|
+
if(object instanceof GMaps) object = object.map;
|
1889
1941
|
return google.maps.event.addListener(object, event_name, handler);
|
1890
1942
|
}
|
1891
1943
|
else {
|
@@ -1903,6 +1955,7 @@ GMaps.on = function(event_name, object, handler) {
|
|
1903
1955
|
|
1904
1956
|
GMaps.off = function(event_name, object) {
|
1905
1957
|
if (GMaps.custom_events.indexOf(event_name) == -1) {
|
1958
|
+
if(object instanceof GMaps) object = object.map;
|
1906
1959
|
google.maps.event.clearListeners(object, event_name);
|
1907
1960
|
}
|
1908
1961
|
else {
|
@@ -2029,6 +2082,17 @@ if (!google.maps.Polygon.prototype.containsLatLng) {
|
|
2029
2082
|
};
|
2030
2083
|
}
|
2031
2084
|
|
2085
|
+
if (!google.maps.Circle.prototype.containsLatLng) {
|
2086
|
+
google.maps.Circle.prototype.containsLatLng = function(latLng) {
|
2087
|
+
if (google.maps.geometry) {
|
2088
|
+
return google.maps.geometry.spherical.computeDistanceBetween(this.getCenter(), latLng) <= this.getRadius();
|
2089
|
+
}
|
2090
|
+
else {
|
2091
|
+
return true;
|
2092
|
+
}
|
2093
|
+
};
|
2094
|
+
}
|
2095
|
+
|
2032
2096
|
google.maps.LatLngBounds.prototype.containsLatLng = function(latLng) {
|
2033
2097
|
return this.contains(latLng);
|
2034
2098
|
};
|
@@ -2082,4 +2146,4 @@ if (!Array.prototype.indexOf) {
|
|
2082
2146
|
}
|
2083
2147
|
|
2084
2148
|
return GMaps;
|
2085
|
-
}));
|
2149
|
+
}));
|
data/lib/gmapsjs/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmapsjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alvaro Pereyra
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: |-
|
15
15
|
gmaps.js allows you to use the potential of Google Maps in a simple way.
|