Skip to content

Commit

Permalink
added fitler for default style
Browse files Browse the repository at this point in the history
  • Loading branch information
miya0001 committed Jul 7, 2024
1 parent 95d4323 commit 967b9f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion geolonia-open-gis.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}

if ( ! defined( 'GEOLONIA_GIS_DEFAULT_STYLE' ) ) {
define( 'GEOLONIA_GIS_DEFAULT_STYLE', plugins_url( '/styles/standard.json', __FILE__ ) );
define( 'GEOLONIA_GIS_DEFAULT_STYLE', apply_filters( 'geolonia-open-gis-default-style', plugins_url( '/styles/standard.json', __FILE__ ) ) );
}

if ( ! defined( 'GEOLONIA_GIS_DEFAULT_ZOOM' ) ) {
Expand Down
14 changes: 13 additions & 1 deletion js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ if (document.getElementById('geolonia-gis-editor-container')) {

const styleUrl = e.currentTarget.dataset.url
document.getElementById('geolonia-gis-style').value = styleUrl
map.setStyle(styleUrl)
try {
map.setStyle(styleUrl)
} catch (e) {
console.log(e)
}
})
li.addEventListener('mouseover', (e) => {
e.currentTarget.classList.add('hover')
Expand All @@ -190,6 +194,14 @@ if (document.getElementById('geolonia-gis-editor-container')) {
})
})

document.getElementById('geolonia-gis-style').addEventListener('change', (e) => {
try {
map.setStyle(e.currentTarget.value)
} catch (e) {
console.log(e)
}
});

map.on('load', () => {

map.addControl(draw, 'top-right') // draw の各種コントロールを追加
Expand Down

0 comments on commit 967b9f3

Please sign in to comment.