chore(label-editing): deselect element during editing
This commit is contained in:
parent
4428be4227
commit
66c7a31d34
|
@ -16,7 +16,7 @@ var MIN_BOUNDS = {
|
|||
};
|
||||
|
||||
|
||||
function LabelEditingProvider(eventBus, canvas, directEditing, commandStack) {
|
||||
function LabelEditingProvider(eventBus, canvas, directEditing, commandStack, injector) {
|
||||
|
||||
directEditing.registerProvider(this);
|
||||
commandStack.registerHandler('element.updateLabel', UpdateLabelHandler);
|
||||
|
@ -40,10 +40,37 @@ function LabelEditingProvider(eventBus, canvas, directEditing, commandStack) {
|
|||
directEditing.complete();
|
||||
});
|
||||
|
||||
// remove and restore selection during direct editing
|
||||
|
||||
(function() {
|
||||
|
||||
try {
|
||||
var selection = injector.get('selection');
|
||||
|
||||
var localSelection;
|
||||
|
||||
eventBus.on('directEditing.activate', function() {
|
||||
localSelection = selection.get();
|
||||
selection.select(null);
|
||||
});
|
||||
|
||||
eventBus.on('directEditing.deactivate', function() {
|
||||
selection.select(localSelection);
|
||||
localSelection = null;
|
||||
});
|
||||
} catch (e) { }
|
||||
|
||||
})();
|
||||
|
||||
|
||||
this._canvas = canvas;
|
||||
this._commandStack = commandStack;
|
||||
}
|
||||
|
||||
LabelEditingProvider.$inject = [ 'eventBus', 'canvas', 'directEditing', 'commandStack', 'injector' ];
|
||||
|
||||
module.exports = LabelEditingProvider;
|
||||
|
||||
|
||||
LabelEditingProvider.prototype.activate = function(element) {
|
||||
|
||||
|
@ -112,9 +139,4 @@ LabelEditingProvider.prototype.update = function(element, newLabel) {
|
|||
element: element,
|
||||
newLabel: newLabel
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
LabelEditingProvider.$inject = [ 'eventBus', 'canvas', 'directEditing', 'commandStack' ];
|
||||
|
||||
module.exports = LabelEditingProvider;
|
||||
};
|
|
@ -42,7 +42,7 @@ function LabelSupport(eventBus, modeling, bpmnFactory) {
|
|||
|
||||
var label = element.label;
|
||||
|
||||
if (label && dragContext.shapes.indexOf(label) === -1) {
|
||||
if (label && !label.hidden && dragContext.shapes.indexOf(label) === -1) {
|
||||
dragContext.shapes.push(label);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue