Customisable Layers button title

This commit is contained in:
James Lyne 2021-05-28 21:28:21 +01:00
parent 387c92e3cb
commit ace8555a09
5 changed files with 8 additions and 2 deletions

View File

@ -109,7 +109,8 @@
contextMenuCopyLink: 'Copy link to here', contextMenuCopyLink: 'Copy link to here',
contextMenuCenterHere: 'Center here', contextMenuCenterHere: 'Center here',
toggleTitle: 'Click to toggle this section', toggleTitle: 'Click to toggle this section',
mapTitle: 'Map - Use the arrow keys to pan the map' mapTitle: 'Map - Use the arrow keys to pan the map',
layersTitle: 'Layers',
} }
}; };
</script> </script>

View File

@ -97,6 +97,7 @@ function buildMessagesConfig(response: any): LiveAtlasMessageConfig {
contextMenuCenterHere: liveAtlasMessages.contextMenuCenterHere || '', contextMenuCenterHere: liveAtlasMessages.contextMenuCenterHere || '',
toggleTitle: liveAtlasMessages.toggleTitle || '', toggleTitle: liveAtlasMessages.toggleTitle || '',
mapTitle: liveAtlasMessages.mapTitle || '', mapTitle: liveAtlasMessages.mapTitle || '',
layersTitle: liveAtlasMessages.layersTitle || '',
} }
} }

1
src/index.d.ts vendored
View File

@ -58,6 +58,7 @@ interface LiveAtlasMessageConfig {
contextMenuCenterHere: string; contextMenuCenterHere: string;
toggleTitle: string; toggleTitle: string;
mapTitle: string; mapTitle: string;
layersTitle: string;
} }
export type LiveAtlasUIElement = 'layers' | 'chat' | 'players' | 'maps' | 'settings'; export type LiveAtlasUIElement = 'layers' | 'chat' | 'players' | 'maps' | 'settings';

View File

@ -94,7 +94,7 @@ export class DynmapLayerControl extends Control.Layers {
section.style.display = 'none'; section.style.display = 'none';
button.title = 'Layers'; button.title = store.state.messages.layersTitle;
button.setAttribute('aria-expanded', 'false'); button.setAttribute('aria-expanded', 'false');
button.innerHTML = ` button.innerHTML = `
<svg class="svg-icon" aria-hidden="true"> <svg class="svg-icon" aria-hidden="true">
@ -114,6 +114,8 @@ export class DynmapLayerControl extends Control.Layers {
this.visible = store.state.ui.visibleElements.has('layers'); this.visible = store.state.ui.visibleElements.has('layers');
}); });
watch(store.state.messages, (newValue) => (button.title = newValue.layersTitle));//
this.visible = store.state.ui.visibleElements.has('layers'); this.visible = store.state.ui.visibleElements.has('layers');
if (this.visible) { if (this.visible) {

View File

@ -132,6 +132,7 @@ export const state: State = {
contextMenuCenterHere: '', contextMenuCenterHere: '',
toggleTitle: '', toggleTitle: '',
mapTitle: '', mapTitle: '',
layersTitle: '',
}, },
loggedIn: false, loggedIn: false,