gmaps4rails 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5258e3e4ac28ce4aee9b51391b51941f70107ab
4
- data.tar.gz: f3226ab987085968259cd22c0667c4121e254ae7
3
+ metadata.gz: 66e8ba074b32b4fdd7e122e2c512c50a826068b6
4
+ data.tar.gz: 9eca5c6b222f11266666d1e2e149558e90bf2cdb
5
5
  SHA512:
6
- metadata.gz: 4e5d0937d72dfab9bb75e534d8facc9df45e731df75b29129a65baff56af69f98c9ac04c5fb3a079ca40c3b6a0281db8cb335bc92bd6587deec1d3b502c44b57
7
- data.tar.gz: 3d61f999c92e529e8ae4fe3ec53da86fd0ffc67854e256f178e13e0c42df29aa2ea458b78dca2135383ae6333fccbee78356c6e79b985ec126665e88ac72b80b
6
+ metadata.gz: 845a7f4fb3874697bd3f4cd58e610c5955df650cdb4ece016a07cf79bb213ddd728b10f6f47fb32edcd10ed7e62542204bd1d87a9bc23ff8db848688ed49a36e
7
+ data.tar.gz: 4349d5157a5b9360474ee3a79772d85bd3b4fedf12ee3ade55cdf2d4575fba16d625ba5ae4986934c1384c3c3f7980b4b2f9a2233f29425532799911c3e72181
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gmaps4rails (2.1.0)
4
+ gmaps4rails (2.1.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -496,12 +496,12 @@
496
496
  this.infowindow_binding = __bind(this.infowindow_binding, this);
497
497
  this.before_init();
498
498
  this.create_marker();
499
- this.create_infowindow();
499
+ this.create_infowindow_on_click();
500
500
  this.after_init();
501
501
  }
502
502
 
503
503
  Marker.prototype.build = function() {
504
- return new (this.model_class())(this.serviceObject, this.infowindow);
504
+ return this.marker = new (this.model_class())(this.serviceObject);
505
505
  };
506
506
 
507
507
  Marker.prototype.create_marker = function() {
@@ -512,10 +512,9 @@
512
512
  if (!_.isString(this.args.infowindow)) {
513
513
  return null;
514
514
  }
515
- this.infowindow = new (this.primitives().infowindow)({
515
+ return new (this.primitives().infowindow)({
516
516
  content: this.args.infowindow
517
517
  });
518
- return this.bind_infowindow();
519
518
  };
520
519
 
521
520
  Marker.prototype.marker_options = function() {
@@ -530,23 +529,29 @@
530
529
  return _.extend(this.provider_options, base_options);
531
530
  };
532
531
 
533
- Marker.prototype.bind_infowindow = function() {
532
+ Marker.prototype.create_infowindow_on_click = function() {
534
533
  return this.addListener('click', this.infowindow_binding);
535
534
  };
536
535
 
537
536
  Marker.prototype.infowindow_binding = function() {
538
- this.panTo();
537
+ var _base;
539
538
  if (this._should_close_infowindow()) {
540
539
  this.constructor.CURRENT_INFOWINDOW.close();
541
540
  }
541
+ this.marker.panTo();
542
+ if (this.infowindow == null) {
543
+ this.infowindow = this.create_infowindow();
544
+ }
545
+ if (this.infowindow == null) {
546
+ return;
547
+ }
542
548
  this.infowindow.open(this.getServiceObject().getMap(), this.getServiceObject());
549
+ if ((_base = this.marker).infowindow == null) {
550
+ _base.infowindow = this.infowindow;
551
+ }
543
552
  return this.constructor.CURRENT_INFOWINDOW = this.infowindow;
544
553
  };
545
554
 
546
- Marker.prototype.panTo = function() {
547
- return this.getServiceObject().getMap().panTo(this.getServiceObject().getPosition());
548
- };
549
-
550
555
  Marker.prototype._get_picture = function(picture_name) {
551
556
  if (!_.isObject(this.args[picture_name]) || !_.isString(this.args[picture_name].url)) {
552
557
  return null;
@@ -841,9 +846,8 @@
841
846
 
842
847
  Marker.include(Gmaps.Google.Objects.Common);
843
848
 
844
- function Marker(serviceObject, infowindow) {
849
+ function Marker(serviceObject) {
845
850
  this.serviceObject = serviceObject;
846
- this.infowindow = infowindow;
847
851
  }
848
852
 
849
853
  Marker.prototype.updateBounds = function(bounds) {
@@ -872,7 +876,16 @@
872
876
  this.serviceObject = serviceObject;
873
877
  }
874
878
 
875
- Polygon.prototype.updateBounds = function(bounds) {};
879
+ Polygon.prototype.updateBounds = function(bounds) {
880
+ var ll, _i, _len, _ref, _results;
881
+ _ref = this.serviceObject.getPath().getArray();
882
+ _results = [];
883
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
884
+ ll = _ref[_i];
885
+ _results.push(bounds.extend(ll));
886
+ }
887
+ return _results;
888
+ };
876
889
 
877
890
  return Polygon;
878
891
 
@@ -892,7 +905,16 @@
892
905
  this.serviceObject = serviceObject;
893
906
  }
894
907
 
895
- Polyline.prototype.updateBounds = function(bounds) {};
908
+ Polyline.prototype.updateBounds = function(bounds) {
909
+ var ll, _i, _len, _ref, _results;
910
+ _ref = this.serviceObject.getPath().getArray();
911
+ _results = [];
912
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
913
+ ll = _ref[_i];
914
+ _results.push(bounds.extend(ll));
915
+ }
916
+ return _results;
917
+ };
896
918
 
897
919
  return Polyline;
898
920
 
@@ -1,3 +1,3 @@
1
1
  module Gmaps4rails
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -30,7 +30,7 @@ class @Gmaps.Google.Builders.Marker extends Gmaps.Objects.BaseBuilder
30
30
  @after_init()
31
31
 
32
32
  build: ->
33
- @object = new(@model_class())(@serviceObject)
33
+ @marker = new(@model_class())(@serviceObject)
34
34
 
35
35
  create_marker: ->
36
36
  @serviceObject = new(@primitives().marker)(@marker_options())
@@ -53,18 +53,15 @@ class @Gmaps.Google.Builders.Marker extends Gmaps.Objects.BaseBuilder
53
53
 
54
54
  infowindow_binding: =>
55
55
  @constructor.CURRENT_INFOWINDOW.close() if @_should_close_infowindow()
56
- @panTo()
56
+ @marker.panTo()
57
57
  @infowindow ?= @create_infowindow()
58
58
 
59
59
  return unless @infowindow?
60
60
 
61
61
  @infowindow.open( @getServiceObject().getMap(), @getServiceObject())
62
- @object.infowindow ?= @infowindow
62
+ @marker.infowindow ?= @infowindow
63
63
  @constructor.CURRENT_INFOWINDOW = @infowindow
64
64
 
65
- panTo: ->
66
- @getServiceObject().getMap().panTo @getServiceObject().getPosition()
67
-
68
65
  _get_picture: (picture_name)->
69
66
  return null if !_.isObject(@args[picture_name]) || !_.isString(@args[picture_name].url)
70
67
  @_create_or_retrieve_image @_picture_args(picture_name)
@@ -5,4 +5,4 @@ class @Gmaps.Google.Objects.Polygon extends Gmaps.Base
5
5
  constructor: (@serviceObject)->
6
6
 
7
7
  updateBounds: (bounds)->
8
- #even not provided by google...
8
+ bounds.extend ll for ll in @serviceObject.getPath().getArray()
@@ -5,4 +5,4 @@ class @Gmaps.Google.Objects.Polyline extends Gmaps.Base
5
5
  constructor: (@serviceObject)->
6
6
 
7
7
  updateBounds: (bounds)->
8
- #even not provided by google...
8
+ bounds.extend ll for ll in @serviceObject.getPath().getArray()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gmaps4rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Roth
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-14 00:00:00.000000000 Z
12
+ date: 2013-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec