fix(drilldown): ensure single overlay per element

This commit is contained in:
Martin Stamm 2021-12-17 10:15:10 +01:00 committed by Nico Rehwaldt
parent 4bd64e45e4
commit 8fe63efdf5
2 changed files with 20 additions and 0 deletions

View File

@ -142,6 +142,11 @@ DrilldownOverlayBehavior.prototype.addOverlay = function(element) {
var canvas = this._canvas;
var overlays = this._overlays;
var existingOverlays = overlays.get({ element: element, type: 'drilldown' });
if (existingOverlays.length) {
this.removeOverlay(element);
}
var button = domify('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
button.addEventListener('click', function() {

View File

@ -388,4 +388,19 @@ describe('features/modeling/behavior - subprocess planes', function() {
});
it('should only show one overlay', inject(function(elementRegistry, overlays, modeling) {
// given
var filledSubProcess = elementRegistry.get('Subprocess_with_content');
var emptySubProcessPlane = elementRegistry.get('Subprocess_empty_plane');
// when
modeling.moveShape(filledSubProcess, { x: 0, y: 0 }, emptySubProcessPlane);
// then
var elementOverlays = overlays.get({ element: filledSubProcess });
expect(elementOverlays).to.have.lengthOf(1);
}));
});