mirror of
https://github.com/bpmn-io/bpmn-js.git
synced 2025-08-14 11:11:14 +08:00
feat(snapping): add bpmn-specific move snapping
This commit adds message flow + collaboration specific snapping by subclassing the diagram-js provided default Snapping implementation. * Add collaboration snapping * Rename lib/util/{Name}.js -> lib/util/{Name}Util.js Closes #255
This commit is contained in:

committed by
Ricardo Matias

parent
d8ef4772cd
commit
b233ab957c
31
lib/util/ModelUtil.js
Normal file
31
lib/util/ModelUtil.js
Normal file
@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Is an element of the given BPMN type?
|
||||
*
|
||||
* @param {djs.model.Base|ModdleElement} element
|
||||
* @param {String} type
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function is(element, type) {
|
||||
var bo = getBusinessObject(element);
|
||||
|
||||
return bo && bo.$instanceOf(type);
|
||||
}
|
||||
|
||||
module.exports.is = is;
|
||||
|
||||
|
||||
/**
|
||||
* Return the business object for a given element.
|
||||
*
|
||||
* @param {djs.model.Base|ModdleElement} element
|
||||
*
|
||||
* @return {ModdleElement}
|
||||
*/
|
||||
function getBusinessObject(element) {
|
||||
return (element && element.businessObject) || element;
|
||||
}
|
||||
|
||||
module.exports.getBusinessObject = getBusinessObject;
|
Reference in New Issue
Block a user