mirror of
https://github.com/bpmn-io/bpmn-js.git
synced 2025-08-26 04:32:44 +08:00
feat(modeling): implement create via palette/context-pad
Related to #137
This commit is contained in:
@ -24,15 +24,16 @@ var CreateShapeHandler = require('diagram-js/lib/features/modeling/cmd/CreateSha
|
||||
* BPMN 2.0 modeling features activator
|
||||
*
|
||||
* @param {EventBus} eventBus
|
||||
* @param {ElementFactory} elementFactory
|
||||
* @param {CommandStack} commandStack
|
||||
*/
|
||||
function Modeling(eventBus, commandStack) {
|
||||
BaseModeling.call(this, eventBus, commandStack);
|
||||
function Modeling(eventBus, elementFactory, commandStack) {
|
||||
BaseModeling.call(this, eventBus, elementFactory, commandStack);
|
||||
}
|
||||
|
||||
Modeling.prototype = Object.create(BaseModeling.prototype);
|
||||
|
||||
Modeling.$inject = [ 'eventBus', 'commandStack' ];
|
||||
Modeling.$inject = [ 'eventBus', 'elementFactory', 'commandStack' ];
|
||||
|
||||
module.exports = Modeling;
|
||||
|
||||
@ -63,30 +64,6 @@ Modeling.prototype.updateLabel = function(element, newLabel) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Append a flow node to the element with the given source
|
||||
* at the specified position.
|
||||
*/
|
||||
Modeling.prototype.appendFlowNode = function(source, type, position) {
|
||||
|
||||
position = position || {
|
||||
x: source.x + source.width + 100,
|
||||
y: source.y + source.height / 2
|
||||
};
|
||||
|
||||
return this.appendShape(source, { type: type }, position, null, { attrs: { type: 'bpmn:SequenceFlow' } });
|
||||
};
|
||||
|
||||
Modeling.prototype.appendTextAnnotation = function(source, type, position) {
|
||||
|
||||
position = position || {
|
||||
x: source.x + source.width / 2 + 75,
|
||||
y: source.y - (source.height / 2) - 100
|
||||
};
|
||||
|
||||
return this.appendShape(source, { type: type }, position, null, { attrs: { type: 'bpmn:Association' } });
|
||||
};
|
||||
|
||||
Modeling.prototype.connect = function(source, target, attrs) {
|
||||
|
||||
var sourceBo = source.businessObject,
|
||||
|
Reference in New Issue
Block a user