fix(drilldown): ensure single overlay per element
This commit is contained in:
parent
4bd64e45e4
commit
8fe63efdf5
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue