BpmnGridSnapping.js 575 B

12345678910111213141516171819202122232425
  1. import { isAny } from '../modeling/util/ModelingUtil';
  2. export default function BpmnGridSnapping(eventBus) {
  3. eventBus.on([
  4. 'create.init',
  5. 'shape.move.init'
  6. ], function(event) {
  7. var context = event.context,
  8. shape = event.shape;
  9. if (isAny(shape, [
  10. 'bpmn:Participant',
  11. 'bpmn:SubProcess',
  12. 'bpmn:TextAnnotation'
  13. ])) {
  14. if (!context.gridSnappingContext) {
  15. context.gridSnappingContext = {};
  16. }
  17. context.gridSnappingContext.snapLocation = 'top-left';
  18. }
  19. });
  20. }
  21. BpmnGridSnapping.$inject = [ 'eventBus' ];