Hi.I want to know whether we can set the default position for the initialization of shapes and tools in bpmn. Let me explain.I want shapes to appear in the middle of the canvas when clicking the any shape icon on the palette.Currently when clicking any icon in the palette whether it is custom or default shape,user has to drag the shape from the palette onto the canvas.Can it be possible that if user clicks the icon,the shape automatically appears on the canvas,some point visible not behind the palette ?if you so,kindly let me know
thanks for your reply.Actually i have gone through the custom Palette code and in function `
createAction(type, group, className, title, options)
{
function createListener(event,className)
{
var shape = elementFactory.createShape(assign({ type: type }, options));
if (options) {
shape.businessObject.di.isExpanded = options.isExpanded;
}
create.start(event, shape);
}
var shortType = type.replace(/^bpmn:/, '');
return {
group: group,
className: className,
title: title || 'Create ' + shortType,
action: {
dragstart: createListener,
click: createListener
}
};}
`
there are no attributes which are assigning the x and y co-ordinates of any tool.Moreover i have also gone through the code in ElementFactory.js and have not found any clue
Thanks
You’d have to specify a different click function that doesn’t call create.start but instead calls something like modeling.createShape with the default position specified. Have a look at how the modeling API works.