leaflet-rails 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,17 @@ module Leaflet
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
if options[:circles]
|
25
|
+
options[:circles].each do |circle|
|
26
|
+
output << "L.circle(['#{circle[:latlng][0]}', '#{circle[:latlng][1]}'], #{circle[:radius]}, {
|
27
|
+
color: '#{circle[:color]}',
|
28
|
+
fillColor: '#{circle[:fillColor]}',
|
29
|
+
fillOpacity: #{circle[:fillOpacity]}
|
30
|
+
}).addTo(map);"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
23
34
|
output << "L.tileLayer('#{options[:tile_layer]}', {
|
24
35
|
attribution: '#{options[:attribution]}',
|
25
36
|
maxZoom: #{options[:max_zoom]}
|
data/spec/view_helpers_spec.rb
CHANGED
@@ -95,5 +95,27 @@ describe Leaflet::ViewHelpers do
|
|
95
95
|
result1.should match(/L.map\('second_map'/)
|
96
96
|
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
|
+
it 'should generate a map and add a circle' do
|
100
|
+
result = @view.map(
|
101
|
+
:container_id => "first_map",
|
102
|
+
:center => {
|
103
|
+
:latlng => [51.52238797921441, -0.08366235665359283]
|
104
|
+
},
|
105
|
+
:circles => [
|
106
|
+
{
|
107
|
+
:latlng => [51.52238797921441, -0.08366235665359283],
|
108
|
+
:radius => 12,
|
109
|
+
:color => 'red',
|
110
|
+
:fillColor => '#f03',
|
111
|
+
:fillOpacity => 0.5
|
112
|
+
}
|
113
|
+
])
|
114
|
+
result.should match(/L.circle\(\[\'51.52238797921441\', \'-0.08366235665359283\'\], 12, \{
|
115
|
+
color: \'red\',
|
116
|
+
fillColor: \'#f03\',
|
117
|
+
fillOpacity: 0.5
|
118
|
+
\}\).addTo\(map\)/)
|
119
|
+
end
|
120
|
+
|
99
121
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
var oldL = window.L,
|
8
8
|
L = {};
|
9
9
|
|
10
|
-
L.version = '0.7.
|
10
|
+
L.version = '0.7.2';
|
11
11
|
|
12
12
|
// define Leaflet for Node module pattern loaders, including Browserify
|
13
13
|
if (typeof module === 'object' && typeof module.exports === 'object') {
|
@@ -2895,7 +2895,7 @@ L.TileLayer = L.Class.extend({
|
|
2895
2895
|
_getWrapTileNum: function () {
|
2896
2896
|
var crs = this._map.options.crs,
|
2897
2897
|
size = crs.getSize(this._map.getZoom());
|
2898
|
-
return size.divideBy(this.
|
2898
|
+
return size.divideBy(this._getTileSize())._floor();
|
2899
2899
|
},
|
2900
2900
|
|
2901
2901
|
_adjustTilePoint: function (tilePoint) {
|
@@ -6527,26 +6527,15 @@ L.DomEvent = {
|
|
6527
6527
|
},
|
6528
6528
|
|
6529
6529
|
getMousePosition: function (e, container) {
|
6530
|
-
var body = document.body,
|
6531
|
-
docEl = document.documentElement,
|
6532
|
-
//gecko makes scrollLeft more negative as you scroll in rtl, other browsers don't
|
6533
|
-
//ref: https://code.google.com/p/closure-library/source/browse/closure/goog/style/bidi.js
|
6534
|
-
x = L.DomUtil.documentIsLtr() ?
|
6535
|
-
(e.pageX ? e.pageX - body.scrollLeft - docEl.scrollLeft : e.clientX) :
|
6536
|
-
(L.Browser.gecko ? e.pageX - body.scrollLeft - docEl.scrollLeft :
|
6537
|
-
e.pageX ? e.pageX - body.scrollLeft + docEl.scrollLeft : e.clientX),
|
6538
|
-
y = e.pageY ? e.pageY - body.scrollTop - docEl.scrollTop: e.clientY,
|
6539
|
-
pos = new L.Point(x, y);
|
6540
|
-
|
6541
6530
|
if (!container) {
|
6542
|
-
return
|
6531
|
+
return new L.Point(e.clientX, e.clientY);
|
6543
6532
|
}
|
6544
6533
|
|
6545
|
-
var rect = container.getBoundingClientRect()
|
6546
|
-
left = rect.left - container.clientLeft,
|
6547
|
-
top = rect.top - container.clientTop;
|
6534
|
+
var rect = container.getBoundingClientRect();
|
6548
6535
|
|
6549
|
-
return
|
6536
|
+
return new L.Point(
|
6537
|
+
e.clientX - rect.left - container.clientLeft,
|
6538
|
+
e.clientY - rect.top - container.clientTop);
|
6550
6539
|
},
|
6551
6540
|
|
6552
6541
|
getWheelDelta: function (e) {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leaflet-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|