mirror of
https://github.com/bpmn-io/bpmn-js.git
synced 2025-08-16 21:01:09 +08:00
chore(label-editing): deselect element during editing
This commit is contained in:
@ -16,7 +16,7 @@ var MIN_BOUNDS = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function LabelEditingProvider(eventBus, canvas, directEditing, commandStack) {
|
function LabelEditingProvider(eventBus, canvas, directEditing, commandStack, injector) {
|
||||||
|
|
||||||
directEditing.registerProvider(this);
|
directEditing.registerProvider(this);
|
||||||
commandStack.registerHandler('element.updateLabel', UpdateLabelHandler);
|
commandStack.registerHandler('element.updateLabel', UpdateLabelHandler);
|
||||||
@ -40,10 +40,37 @@ function LabelEditingProvider(eventBus, canvas, directEditing, commandStack) {
|
|||||||
directEditing.complete();
|
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._canvas = canvas;
|
||||||
this._commandStack = commandStack;
|
this._commandStack = commandStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LabelEditingProvider.$inject = [ 'eventBus', 'canvas', 'directEditing', 'commandStack', 'injector' ];
|
||||||
|
|
||||||
|
module.exports = LabelEditingProvider;
|
||||||
|
|
||||||
|
|
||||||
LabelEditingProvider.prototype.activate = function(element) {
|
LabelEditingProvider.prototype.activate = function(element) {
|
||||||
|
|
||||||
@ -112,9 +139,4 @@ LabelEditingProvider.prototype.update = function(element, newLabel) {
|
|||||||
element: element,
|
element: element,
|
||||||
newLabel: newLabel
|
newLabel: newLabel
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
LabelEditingProvider.$inject = [ 'eventBus', 'canvas', 'directEditing', 'commandStack' ];
|
|
||||||
|
|
||||||
module.exports = LabelEditingProvider;
|
|
@ -42,7 +42,7 @@ function LabelSupport(eventBus, modeling, bpmnFactory) {
|
|||||||
|
|
||||||
var label = element.label;
|
var label = element.label;
|
||||||
|
|
||||||
if (label && dragContext.shapes.indexOf(label) === -1) {
|
if (label && !label.hidden && dragContext.shapes.indexOf(label) === -1) {
|
||||||
dragContext.shapes.push(label);
|
dragContext.shapes.push(label);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user