mapkick-rb 0.1.4 → 0.2.0

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
  SHA256:
3
- metadata.gz: f5a2b37b33ecba167e0844af635b9a87a3afad84eb92b06e19cd3db6ecf6ceb8
4
- data.tar.gz: db38e21238698891fa79c21dfcafddba4b97fe3e4b31a91083871279a90836bb
3
+ metadata.gz: 72b4e7f11d231af669eca1d15be9d7eb232682d79d97a62a43c37a8fd3c29224
4
+ data.tar.gz: 00c46432b3f444fd89fa1de0f769543655ff0c92c69c40387a63a7c3c08c905b
5
5
  SHA512:
6
- metadata.gz: 54729a215c5960c9b73395d98a395941231fa76b6e7b8c9c4d85364f5299e6c4032ac66d08988b236a4fe06a0f40018be997eb53822d44c11003671c4143e43b
7
- data.tar.gz: 303226c8be546b020ff81054559f8cff01560ac5a1c26f30f97b1931e1990dcb9186db4a6a885530b80714e89db3de92881f554253ec6c164a47794a3b787034
6
+ metadata.gz: d61392f1838510659cbadbec1a1fe263f10dadc1d1cbf04a2ee749c3e38040a6f8cf0d850cd1e8fe2e1ce004be9bba24426ac411d858d9277e65fbcd5c787814
7
+ data.tar.gz: b0e5788e438f01d2075aa4fb24ac40ffd13cec83bdbe67ef6fe35ee645d1b4d9343d91356cf81b35b0cce6406e771f07deb0609c569f5b8cf6e2a236b08832cd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.2.0 (2024-10-26)
2
+
3
+ - Dropped support for Ruby < 3.1
4
+
5
+ ## 0.1.5 (2023-07-24)
6
+
7
+ - Updated Mapkick.js to 0.2.6
8
+ - Support for area maps is no longer experimental
9
+
1
10
  ## 0.1.4 (2023-03-11)
2
11
 
3
12
  - Updated Mapkick.js to 0.2.5
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2023 Andrew Kane
1
+ Copyright (c) 2023-2024 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -4,9 +4,9 @@ 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
- [![Build Status](https://github.com/ankane/mapkick/workflows/build/badge.svg?branch=master)](https://github.com/ankane/mapkick/actions)
9
+ [![Build Status](https://github.com/ankane/mapkick/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/mapkick/actions)
10
10
 
11
11
  ## Installation
12
12
 
@@ -85,7 +85,7 @@ Point map
85
85
  <%= js_map [{latitude: 37.7829, longitude: -122.4190}] %>
86
86
  ```
87
87
 
88
- Area map (experimental)
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/) 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:
@@ -4,7 +4,7 @@ module Mapkick
4
4
 
5
5
  # for importmap
6
6
  initializer "mapkick.importmap" do |app|
7
- if defined?(Importmap)
7
+ if app.config.respond_to?(:assets) && defined?(Importmap) && defined?(Sprockets)
8
8
  app.config.assets.precompile << "mapkick.bundle.js"
9
9
  end
10
10
  end
@@ -50,7 +50,7 @@ module Mapkick
50
50
  # limit to alphanumeric and % for simplicity
51
51
  # this prevents things like calc() but safety is the priority
52
52
  # dot does not need escaped in square brackets
53
- raise ArgumentError, "Invalid #{k}" unless html_vars[k] =~ /\A[a-zA-Z0-9%.]*\z/
53
+ raise ArgumentError, "Invalid #{k}" unless /\A[a-zA-Z0-9%.]*\z/.match?(html_vars[k])
54
54
  end
55
55
 
56
56
  html_vars.each_key do |k|
@@ -1,3 +1,3 @@
1
1
  module Mapkick
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  ================================================================================
2
- Mapkick.js 0.2.5
2
+ Mapkick.js 0.2.6
3
3
  ================================================================================
4
4
 
5
5
  Copyright (c) 2017-2023 Andrew Kane
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * This bundle includes:
3
3
  *
4
- * Mapkick.js v0.2.5
4
+ * Mapkick.js v0.2.6
5
5
  * https://github.com/ankane/mapkick.js
6
6
  * MIT License
7
7
  *
@@ -888,6 +888,9 @@
888
888
  }
889
889
  }
890
890
  }
891
+ if (!zoom) {
892
+ zoom = 15;
893
+ }
891
894
 
892
895
  var mapOptions = {
893
896
  container: element,
@@ -895,7 +898,7 @@
895
898
  dragRotate: false,
896
899
  touchZoomRotate: false,
897
900
  center: center,
898
- zoom: zoom || 15
901
+ zoom: zoom
899
902
  };
900
903
  if (!options.style) {
901
904
  mapOptions.projection = "mercator";
@@ -903,6 +906,9 @@
903
906
  if (options.accessToken) {
904
907
  mapOptions.accessToken = options.accessToken;
905
908
  }
909
+ if (options.library) {
910
+ Object.assign(mapOptions, options.library);
911
+ }
906
912
  map = new library.Map(mapOptions);
907
913
 
908
914
  if (options.controls) {
@@ -915,7 +921,8 @@
915
921
  map.style.stylesheet = {};
916
922
  }
917
923
 
918
- if (!bounds.isEmpty()) {
924
+ // check zoom for hash library option
925
+ if (!bounds.isEmpty() && map.getZoom() === zoom) {
919
926
  map.fitBounds(bounds, {padding: 40, animate: false, maxZoom: 15});
920
927
  }
921
928
  }
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
4
+ version: 0.2.0
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-03-11 00:00:00.000000000 Z
11
+ date: 2024-10-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: andrew@ankane.org
@@ -40,14 +40,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: '2.7'
43
+ version: '3.1'
44
44
  required_rubygems_version: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  requirements: []
50
- rubygems_version: 3.4.6
50
+ rubygems_version: 3.5.16
51
51
  signing_key:
52
52
  specification_version: 4
53
53
  summary: Create beautiful JavaScript maps with one line of Ruby