This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #286 from QwantResearch/easter-egg
Add "fraicheur" layer via url param
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ server: | |
|
||
app: | ||
versionFlag: Beta | ||
easterEggs: true | ||
|
||
# Services | ||
services: | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import Error from '../adapters/error'; | ||
|
||
export default class MapEasterEgg { | ||
static enableEggs(map) { | ||
this.addIcecreamLayer(map); | ||
} | ||
|
||
static addIcecreamLayer(map) { | ||
if (!URLSearchParams) { | ||
return; | ||
} | ||
let urlParams = new URLSearchParams(window.location.search); | ||
if (urlParams.get('fraicheur') === null) { | ||
return; | ||
} | ||
map.removeLayer('poi-level-1'); | ||
map.setFilter('poi-level-2', ['boolean', false]); | ||
map.setFilter('poi-level-3', ['boolean', false]); | ||
|
||
map.loadImage(`${window.baseUrl}statics/images/sorbet_64.png`, (error, image) => { | ||
if (error) { | ||
Error.sendOnce('scene', 'easter_egg', 'Failed to load image', error); | ||
return; | ||
} | ||
map.addImage('icecream_easter_egg', image); | ||
|
||
map.addLayer({ | ||
'id': 'poi-level-1', | ||
'type': 'symbol', | ||
'source': 'poi', | ||
'source-layer': 'poi', | ||
'minzoom': 14, | ||
'filter': [ | ||
'all', | ||
[ | ||
'==', | ||
'$type', | ||
'Point', | ||
], | ||
[ | ||
'in', | ||
'subclass', | ||
'ice_cream', | ||
], | ||
], | ||
'layout': { | ||
'text-size': 15, | ||
'icon-image': 'icecream_easter_egg', | ||
'text-font': [ | ||
'Noto Sans Regular', | ||
], | ||
'text-padding': 2, | ||
'text-offset': [ | ||
0, | ||
2.5, | ||
], | ||
'text-anchor': 'top', | ||
'text-field': '{name}', | ||
'text-optional': true, | ||
'text-max-width': 12, | ||
}, | ||
'paint': { | ||
'text-halo-blur': 0.5, | ||
'text-color': '#4ba2ea', | ||
'text-halo-width': 1, | ||
'text-halo-color': '#ffffff', | ||
}, | ||
}); | ||
}); | ||
} | ||
} |