-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attribution ShadowDOM #306
Conversation
@keichan34 |
@keichan34 |
@keichan34 プレビュー |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
細かい修正ですがよろしくお願いします。
あと、テスト用のファイルを削除お願いします。(debug.html, style-long-attrb.json)
src/lib/util.js
Outdated
@@ -274,3 +275,128 @@ export const handleRestrictedMode = (map) => { | |||
container.classList.add('geolonia__restricted-mode-image-container'); | |||
} | |||
}; | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maplibreから抽出したutilを別ファイルに分けましょう。maplibre-util.js
とかかな。
もし将来このライブラリをTSに移行したら、簡単に元ソースを参照して使えるようにしたい
src/lib/CustomAttributionControl.js
Outdated
|
||
const style = document.createElement('style'); | ||
style.textContent = ` | ||
.mapboxgl-ctrl, .maplibregl-ctrl { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここでは .mapbox-*
系の互換性のためのセレクタは不要です(shadow DOM内では完全にコントロールされているという環境なので、他のユーザーがこの中に何かしら入れたりすることはないし、外から触れることも無いので)
あ、ごめんなさい。©とその後の文言が改行しないようにCSSを指定したところをみせてもらってもいいですか?(なんか差分に埋もれてしまったような気がします。。。)(そして、debug.htmlのサンプルだとリンクになっていないので本番環境とは若干違うと思います。。 |
@keichan34
こちらの件ですが下のように指定しています。( embed/src/lib/CustomAttributionControl.js Line 174 in e692a52
|
これは確かにですね、、、。 下のように指定し直しました。どうでしょうか? |
なるほど。これでいいですね。ありがとうございました! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
おっと、アプルーブするの忘れた。ありがとうございました!
Attribution Controlが外部のCSSの影響を受けてしまうので、 Attribution Controlのみを ShadowDOMとして追加しました。
最新版の Maplibre GL JS ではスマホで地図を表示した時、デフォルトでアトリビューションがオープンになるように変更があったので、それに併せて CSS を追加しました。
サンプル
https://codepen.io/naogify/pen/RwyMMrp
アトリビューションの open がデフォルトになった理由
ドラフトとして提出されている 新しい OSM の著作権ガイドラインに、ユーザーの操作なしに著作権表示をする項目が盛り込まれため、スマホ時のアトリビューションがデフォルトがオープンにする変更が加えられたとの事でした。
https://wiki.osmfoundation.org/wiki/Licence/Attribution_Guidelines#Interactive_maps:~:text=You%20may%20use,or%20pop%2Dups
Issue
maplibre/maplibre-gl-js#205
PR
maplibre/maplibre-gl-js#795