From b1ff86cd298a9a948223e56c9fa1b7eba92df54a Mon Sep 17 00:00:00 2001 From: laigyu Date: Mon, 15 Apr 2024 14:54:43 +0800 Subject: [PATCH] tooltip update --- data/core.yaml | 4 +++- modules/ui/photoviewer.js | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/data/core.yaml b/data/core.yaml index a60d49d9b..e1cdc636c 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -788,7 +788,9 @@ en: inch: in max_length_reached: "This string is longer than the maximum length of {maxChars} characters. Anything exceeding that length will be truncated." set_today: "Sets the value to today." - set_photo_from_viewer: "Store this photo on the currently selected map object" + set_photo_from_viewer: + enable: "Tag this photo id on the currently selected map object" + disable: "This image is already tagged on this feature" background: title: Background description: Background Settings diff --git a/modules/ui/photoviewer.js b/modules/ui/photoviewer.js index 358ac75ca..06b79cc8b 100644 --- a/modules/ui/photoviewer.js +++ b/modules/ui/photoviewer.js @@ -211,6 +211,23 @@ export function uiPhotoviewer(context) { const button = selection.selectAll('.set-photo-from-viewer').data([0]); button.attr('disabled', disabled ? 'true' : null); button.classed('disabled', disabled); + button.call(uiTooltip().destroyAny); + if (disabled) { + button.call(uiTooltip() + .title(() => t.append('inspector.set_photo_from_viewer.disable')) + .placement('right') + ); + } else { + button.call(uiTooltip() + .title(() => t.append('inspector.set_photo_from_viewer.enable')) + .placement('right') + ); + } + + button.select('.tooltip') + .classed('dark', true) + .style('width', '300px'); + } }