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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6818ca6ff719122c3e42e7d032d7b9c64b430ca
4
- data.tar.gz: af40cf33d7c8eda3eab67d9dc5de3126f5ec0e7f
3
+ metadata.gz: d8b359e813a7ebcf253690c132ff3cf368f13662
4
+ data.tar.gz: e18a21de7f15af974c952f47b2d93db41e2f486d
5
5
  SHA512:
6
- metadata.gz: 37485f4bf381a96ae073c293af146b345b4f50069c65439aaff615250b4ff27daed1b5cb47a36a834ebba4774b39d85c7fc811eeef585e83862cf2307c1d5ef6
7
- data.tar.gz: 58394ec97ddb47042d24d1aa472d1fa27c9f663a056d9d98a8775512d01ece9cfc08ed938fa755347af0672d3889b16bf1012d47c1f91fd9affd892433294dd2
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.12
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 (coords[i].length > 0 && typeof(coords[i][0]) == "object") {
108
- coords[i] = arrayToLatLng(coords[i], useGeoJSON);
109
- }
110
- else {
111
- coords[i] = coordsToLatLngs(coords[i], useGeoJSON);
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
- control.innerHTML = options.content;
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
- this.map.controls[position].push(control);
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].setMap(null);
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
- if (this.markers.indexOf(collection[i]) > -1) {
712
- this.markers[i].setMap(null);
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
- if (this.markers[i].getMap() != null) {
718
- new_markers.push(this.markers[i]);
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 && styles[i].featureType != 'all' ) {
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 && styles[i].elementType != 'all') {
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
+ }));
@@ -1,3 +1,3 @@
1
1
  module GmapsJS
2
- VERSION = "0.4.12"
2
+ VERSION = "0.4.16"
3
3
  end
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.12
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-05-10 00:00:00.000000000 Z
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.