commit b2f43877b14eda647a4b9a9ea86d67664c917000
parent 1fe29f2512546f8344242eb6e95f6af9d351255b
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Sat, 6 Dec 2025 10:21:09 +0100
leaflet.control.layers.configure: change hotkey tooltip for empty and defined hotkey
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/lib/leaflet.control.layers.configure/index.js b/src/lib/leaflet.control.layers.configure/index.js
@@ -63,10 +63,10 @@ class LayersConfigDialog {
<span data-bind="text: title"></span>
<!-- ko if: $root.withHotkeys -->
<div class="hotkey-input"
- title="Change hotkey"
tabindex="0"
data-bind="
text: hotkey,
+ attr: {title: $root.getHotkeyTooltip($data)},
event: {
keyup: $root.onHotkeyInput.bind($root),
keypress: function() {},
@@ -198,6 +198,14 @@ class LayersConfigDialog {
}
layerModel.hotkey(newHotkey);
}
+
+ getHotkeyTooltip(layer) {
+ console.log(layer);
+ return {
+ true: 'Change or remove hotkey',
+ false: 'Set hotkey',
+ }[Boolean(layer.hotkey())];
+ }
}
function enableConfig(control, {layers, customLayersOrder}, options = {withHotkeys: true}) {
diff --git a/src/lib/leaflet.control.layers.configure/style.css b/src/lib/leaflet.control.layers.configure/style.css
@@ -180,6 +180,7 @@
width: 15px;
height: 15px;
border-radius: 2px;
+ cursor: text;
}
.leaflet-layers-config-window .error {