mapkick-rb 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +10 -6
- data/lib/mapkick/version.rb +1 -1
- data/licenses/LICENSE-mapkick-bundle.txt +1 -1
- data/vendor/assets/javascripts/mapkick.bundle.js +27 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fe67a4f4f194dbcd7a4c1c5b0955afe1293e1c7aefe3a568624cf8437b0cd39
|
4
|
+
data.tar.gz: dd9d5486bfacdd560e645bbfd59c6443dbf8e6c10dd1ef22750c7c253ef25380
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df625004ba2e24d600d877dfc372de269ffeb4ec5637672c3db36557c632af5f16e6d5811e54fc157c6e9b1929327129f32271f46c4c619c44df620fe93efb8a
|
7
|
+
data.tar.gz: 6b721f26b678719477ea0e8413a836a4f97ca623dc49f134e695ad459d8a6a6905c9c911a63bc4a81b97627842ebcdac2054028f5732c247fbed4914672bb3e6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Create beautiful JavaScript maps with one line of Ruby. No more fighting with ma
|
|
4
4
|
|
5
5
|
[See it in action](https://chartkick.com/mapkick)
|
6
6
|
|
7
|
-
:fire: For charts, check out [Chartkick](https://chartkick.com)
|
7
|
+
:fire: For static maps, check out [Mapkick Static](https://github.com/ankane/mapkick-static), and for charts, check out [Chartkick](https://chartkick.com)
|
8
8
|
|
9
9
|
[![Build Status](https://github.com/ankane/mapkick/workflows/build/badge.svg?branch=master)](https://github.com/ankane/mapkick/actions)
|
10
10
|
|
@@ -85,7 +85,7 @@ Point map
|
|
85
85
|
<%= js_map [{latitude: 37.7829, longitude: -122.4190}] %>
|
86
86
|
```
|
87
87
|
|
88
|
-
Area map
|
88
|
+
Area map
|
89
89
|
|
90
90
|
```erb
|
91
91
|
<%= area_map [{geometry: {type: "Polygon", coordinates: ...}}] %>
|
@@ -180,6 +180,14 @@ Refresh data from a remote source every `n` seconds
|
|
180
180
|
<%= js_map url, refresh: 60 %>
|
181
181
|
```
|
182
182
|
|
183
|
+
Pass options directly to the mapping library
|
184
|
+
|
185
|
+
```erb
|
186
|
+
<%= js_map data, library: {hash: true} %>
|
187
|
+
```
|
188
|
+
|
189
|
+
See the documentation for [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js/api/map/) and [MapLibre GL JS](https://maplibre.org/maplibre-gl-js-docs/api/map/) for more info
|
190
|
+
|
183
191
|
### Global Options
|
184
192
|
|
185
193
|
To set options for all of your maps, create an initializer `config/initializers/mapkick.rb` with:
|
@@ -196,10 +204,6 @@ Download [mapkick.bundle.js](https://raw.githubusercontent.com/ankane/mapkick/ma
|
|
196
204
|
<script src="mapkick.bundle.js"></script>
|
197
205
|
```
|
198
206
|
|
199
|
-
## No Ruby? No Problem
|
200
|
-
|
201
|
-
Check out [mapkick.js](https://github.com/ankane/mapkick.js)
|
202
|
-
|
203
207
|
## History
|
204
208
|
|
205
209
|
View the [changelog](CHANGELOG.md)
|
data/lib/mapkick/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* This bundle includes:
|
3
3
|
*
|
4
|
-
* Mapkick.js v0.2.
|
4
|
+
* Mapkick.js v0.2.6
|
5
5
|
* https://github.com/ankane/mapkick.js
|
6
6
|
* MIT License
|
7
7
|
*
|
@@ -876,13 +876,29 @@
|
|
876
876
|
}
|
877
877
|
}
|
878
878
|
|
879
|
+
var zoom = options.zoom;
|
880
|
+
var center = options.center;
|
881
|
+
if (!center) {
|
882
|
+
if (!bounds.isEmpty()) {
|
883
|
+
center = bounds.getCenter();
|
884
|
+
} else {
|
885
|
+
center = [0, 0];
|
886
|
+
if (!zoom) {
|
887
|
+
zoom = 1;
|
888
|
+
}
|
889
|
+
}
|
890
|
+
}
|
891
|
+
if (!zoom) {
|
892
|
+
zoom = 15;
|
893
|
+
}
|
894
|
+
|
879
895
|
var mapOptions = {
|
880
896
|
container: element,
|
881
897
|
style: style,
|
882
898
|
dragRotate: false,
|
883
899
|
touchZoomRotate: false,
|
884
|
-
center:
|
885
|
-
zoom:
|
900
|
+
center: center,
|
901
|
+
zoom: zoom
|
886
902
|
};
|
887
903
|
if (!options.style) {
|
888
904
|
mapOptions.projection = "mercator";
|
@@ -890,6 +906,9 @@
|
|
890
906
|
if (options.accessToken) {
|
891
907
|
mapOptions.accessToken = options.accessToken;
|
892
908
|
}
|
909
|
+
if (options.library) {
|
910
|
+
Object.assign(mapOptions, options.library);
|
911
|
+
}
|
893
912
|
map = new library.Map(mapOptions);
|
894
913
|
|
895
914
|
if (options.controls) {
|
@@ -901,7 +920,11 @@
|
|
901
920
|
if (!map.style.stylesheet) {
|
902
921
|
map.style.stylesheet = {};
|
903
922
|
}
|
904
|
-
|
923
|
+
|
924
|
+
// check zoom for hash library option
|
925
|
+
if (!bounds.isEmpty() && map.getZoom() === zoom) {
|
926
|
+
map.fitBounds(bounds, {padding: 40, animate: false, maxZoom: 15});
|
927
|
+
}
|
905
928
|
}
|
906
929
|
|
907
930
|
this$1$1.map = map;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mapkick-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: andrew@ankane.org
|
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
|
-
rubygems_version: 3.4.
|
50
|
+
rubygems_version: 3.4.10
|
51
51
|
signing_key:
|
52
52
|
specification_version: 4
|
53
53
|
summary: Create beautiful JavaScript maps with one line of Ruby
|