all files / Github/bpmn-js/lib/features/grid-snapping/ BpmnGridSnapping.js

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