From ae7eadb89c971bf52332d0ad89405199f3e59414 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Mon, 23 Dec 2019 11:06:23 -0500 Subject: [PATCH] Properly update undo/redo button tooltips when undoing/redoing (close #6872) --- modules/ui/tools/undo_redo.js | 4 ++-- modules/util/popover.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/ui/tools/undo_redo.js b/modules/ui/tools/undo_redo.js index 0974a0d15..b39ff390d 100644 --- a/modules/ui/tools/undo_redo.js +++ b/modules/ui/tools/undo_redo.js @@ -97,8 +97,8 @@ export function uiToolUndoRedo(context) { }) .each(function() { var selection = d3_select(this); - if (selection.property('tooltipVisible')) { - selection.call(tooltipBehavior.show); + if (!selection.select('.tooltip.in').empty()) { + selection.call(tooltipBehavior.updateContent); } }); } diff --git a/modules/util/popover.js b/modules/util/popover.js index 679db193a..19dde71b4 100644 --- a/modules/util/popover.js +++ b/modules/util/popover.js @@ -81,6 +81,10 @@ export function popover(klass) { _anchorSelection.each(show); }; + popover.updateContent = function() { + _anchorSelection.each(updateContent); + }; + popover.hide = function() { _anchorSelection.each(hide); }; @@ -198,6 +202,13 @@ export function popover(klass) { popoverSelection.node().focus(); } + anchor.each(updateContent); + } + + function updateContent() { + var anchor = d3_select(this); + var popoverSelection = anchor.selectAll('.popover-' + _id); + if (_content) popoverSelection.selectAll('.popover-inner').call(_content.apply(this, arguments)); updatePosition.apply(this, arguments);