Skip to content

Commit

Permalink
Diagram - updateToolbox destroys tooltips fix (#20476)
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorSavushkin committed Dec 9, 2021
1 parent c34c9d1 commit b8e7cab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
5 changes: 4 additions & 1 deletion js/ui/diagram/ui.diagram.js
Expand Up @@ -1577,7 +1577,10 @@ class Diagram extends Widget {
}
updateToolbox() {
this._diagramInstance && this._diagramInstance.refreshToolbox();
this._toolbox && this._toolbox.updateMaxHeight();
if(this._toolbox) {
this._toolbox.updateTooltips();
this._toolbox.updateMaxHeight();
}
}

_getDefaultOptions() {
Expand Down
16 changes: 10 additions & 6 deletions js/ui/diagram/ui.diagram.toolbox.js
Expand Up @@ -227,16 +227,17 @@ class DiagramToolbox extends DiagramFloatingPanel {
filteringToolboxes: this._toolboxes.length - 1
});
}
this._createTooltips($toolboxElement.find('[data-toggle="' + DIAGRAM_TOOLTIP_DATATOGGLE + '"]'));
this._createTooltips($toolboxElement);
}
};
result.push(groupObj);
}
return result;
}
_createTooltips(targets) {
_createTooltips($toolboxElement) {
if(this._isTouchMode()) return;

const targets = $toolboxElement.find('[data-toggle="' + DIAGRAM_TOOLTIP_DATATOGGLE + '"]');
const $container = this.$element();
targets.each((index, element) => {
const $target = $(element);
Expand Down Expand Up @@ -319,14 +320,17 @@ class DiagramToolbox extends DiagramFloatingPanel {
text: this._filterText,
filteringToolboxes: this._toolboxes.map(($element, index) => index)
});
this._toolboxes.forEach($element => {
const $tooltipContainer = $($element);
this._createTooltips($tooltipContainer.find('[data-toggle="' + DIAGRAM_TOOLTIP_DATATOGGLE + '"]'));
});
this.updateTooltips();

this.updateMaxHeight();
this._scrollView.update();
}
updateTooltips() {
this._toolboxes.forEach($element => {
const $tooltipContainer = $($element);
this._createTooltips($tooltipContainer);
});
}

_createOnShapeCategoryRenderedAction() {
this._onShapeCategoryRenderedAction = this._createActionByOption('onShapeCategoryRendered');
Expand Down

0 comments on commit b8e7cab

Please sign in to comment.