Skip to content

Commit 32b5f33

Browse files
committed
Compatibility with new Mapbox tiles API urls + ids
1 parent 53449d9 commit 32b5f33

File tree

5 files changed

+23
-16
lines changed

5 files changed

+23
-16
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ return array(
7979

8080
![tiles-mapbox-2](https://user-images.githubusercontent.com/14079751/48648037-2c542380-e9ee-11e8-916d-ca240a40bc20.jpg)
8181

82-
1. `mapbox.outdoors` (default mapbox theme)
83-
2. `mapbox.streets`
84-
3. `mapbox.light`
85-
4. `mapbox.dark`
82+
1. ~~mapbox.outdoors~~ → `mapbox/outdoors-v11` (default mapbox theme)
83+
2. ~~mapbox.streets~~ → `mapbox/streets-v11`
84+
3. ~~mapbox.light~~ → `mapbox/light-v10`
85+
4. ~~mapbox.dark~~ → `mapbox/dark-v10`
8686

8787
In case your usage doesn't fall into the above policies (or if you don't want to rely on those services), you can set-up the field to use Mapbox' tiles.
8888

@@ -92,7 +92,7 @@ You will have to set both the `id` of the tiles you want to use and your mapbox
9292

9393
```php
9494
return array(
95-
'sylvainjule.locator.mapbox.id' => 'mapbox.outdoors',
95+
'sylvainjule.locator.mapbox.id' => 'mapbox/outdoors-v11',
9696
'sylvainjule.locator.mapbox.token' => 'pk.vdf561vf8...',
9797
);
9898
```

index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fields.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,18 @@
5555
return kirby()->url('media') . '/plugins/sylvainjule/locator/images/marker-icon-'. $tint .'.png';
5656
},
5757
'mapbox' => function() {
58+
$idSwap = [
59+
'mapbox.outdoors' => 'mapbox/outdoors-v11',
60+
'mapbox.streets' => 'mapbox/streets-v11',
61+
'mapbox.light' => 'mapbox/light-v10',
62+
'mapbox.dark' => 'mapbox/dark-v10',
63+
];
64+
65+
$setId = option('sylvainjule.locator.mapbox.id');
66+
$id = array_key_exists($setId, $idSwap) ? $idSwap[$setId] : $setId;
67+
5868
return array(
59-
'id' => option('sylvainjule.locator.mapbox.id'),
69+
'id' => $id,
6070
'token' => option('sylvainjule.locator.mapbox.token', ''),
6171
);
6272
}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
"not ie <= 11"
1919
],
2020
"devDependencies": {
21-
"@vue/component-compiler-utils": "^3.0.0",
21+
"@vue/component-compiler-utils": "^3.2.0",
2222
"cssnano": "^4.1.10",
23-
"leaflet": "^1.5.1",
24-
"sass": "^1.21.0",
25-
"vue-template-compiler": "^2.6.11"
23+
"leaflet": "^1.7.1",
24+
"sass": "^1.29.0",
25+
"vue-template-compiler": "^2.6.12"
2626
},
2727
"dependencies": {
28-
"vue": "^2.6.11",
28+
"vue": "^2.6.12",
2929
"vue-hot-reload-api": "^2.3.4"
3030
}
3131
}

src/field/Locator.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,7 @@ export default {
123123
return this.valueExists ? [this.value.lat, this.value.lon] : []
124124
},
125125
tileUrl() {
126-
if(this.tiles == 'mapbox') {
127-
return 'https://api.tiles.mapbox.com/v4/'+ this.mapbox.id +'/{z}/{x}/{y}'+ (L.Browser.retina ? '@2x.png' : '.png') +'?access_token='+ this.mapbox.token
128-
}
129-
else if(this.tiles == 'mapbox.custom') {
126+
if(this.tiles == 'mapbox' || this.tiles == 'mapbox.custom') {
130127
return 'https://api.mapbox.com/styles/v1/'+ this.mapbox.id +'/tiles/256/{z}/{x}/{y}'+ (L.Browser.retina ? '@2x' : '') +'?access_token='+ this.mapbox.token
131128
}
132129
else if(this.tiles == 'wikimedia') {

0 commit comments

Comments
 (0)