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',
contextMenuCenterHere: 'Center here',
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>

View File

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

1
src/index.d.ts vendored
View File

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

View File

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

View File

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