mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-08 23:25:04 +00:00
fix(context-pad): do not open replace menu if context pad not open
Related to camunda/camunda-modeler#1613
This commit is contained in:
parent
af9a273e26
commit
8efb20c03e
@ -56,9 +56,10 @@ export default function ContextPadProvider(
|
|||||||
}
|
}
|
||||||
|
|
||||||
eventBus.on('create.end', 250, function(event) {
|
eventBus.on('create.end', 250, function(event) {
|
||||||
var shape = event.context.shape;
|
var context = event.context,
|
||||||
|
shape = context.shape;
|
||||||
|
|
||||||
if (!hasPrimaryModifier(event)) {
|
if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,6 +424,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
return actions;
|
return actions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// helpers /////////
|
||||||
|
|
||||||
function isEventType(eventBo, type, definition) {
|
function isEventType(eventBo, type, definition) {
|
||||||
|
|
||||||
var isType = eventBo.$instanceOf(type);
|
var isType = eventBo.$instanceOf(type);
|
||||||
@ -436,4 +440,4 @@ function isEventType(eventBo, type, definition) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return isType && isDefinition;
|
return isType && isDefinition;
|
||||||
}
|
}
|
@ -498,6 +498,31 @@ describe('features - context-pad', function() {
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
|
it('should NOT open replace menu if context pad NOT open', inject(
|
||||||
|
function(canvas, create, dragging, elementFactory) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var rootShape = canvas.getRootElement(),
|
||||||
|
startEvent = elementFactory.createShape({ type: 'bpmn:StartEvent' }),
|
||||||
|
task = elementFactory.createShape({ type: 'bpmn:Task' });
|
||||||
|
|
||||||
|
// when
|
||||||
|
create.start(canvasEvent({ x: 0, y: 0 }), [ startEvent, task ]);
|
||||||
|
|
||||||
|
dragging.move(canvasEvent({ x: 50, y: 50 }));
|
||||||
|
dragging.hover({ element: rootShape });
|
||||||
|
dragging.move(canvasEvent({ x: 75, y: 75 }));
|
||||||
|
|
||||||
|
dragging.end(canvasEvent({ x: 75, y: 75 }, { ctrlKey: true, metaKey: true }));
|
||||||
|
|
||||||
|
// then
|
||||||
|
var replaceMenu = domQuery('.bpmn-replace', container);
|
||||||
|
|
||||||
|
expect(replaceMenu).not.to.exist;
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user