1 | import {
|
2 | assign
|
3 | } from 'min-dash';
|
4 |
|
5 | import {
|
6 | getBpmnJS
|
7 | } from 'test/TestHelper';
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | export function createCanvasEvent(position, data) {
|
21 |
|
22 | return getBpmnJS().invoke(function(canvas) {
|
23 |
|
24 | var target = canvas._svg;
|
25 |
|
26 | var clientRect = canvas._container.getBoundingClientRect();
|
27 |
|
28 | var absolutePosition = {
|
29 | x: position.x + clientRect.left,
|
30 | y: position.y + clientRect.top
|
31 | };
|
32 |
|
33 | return createEvent(target, absolutePosition, data);
|
34 | });
|
35 | }
|
36 |
|
37 |
|
38 | export function createEvent(target, position, data) {
|
39 |
|
40 | return getBpmnJS().invoke(function(eventBus) {
|
41 | data = assign({
|
42 | target: target,
|
43 | x: position.x,
|
44 | y: position.y,
|
45 | clientX: position.x,
|
46 | clientY: position.y,
|
47 | offsetX: position.x,
|
48 | offsetY: position.y
|
49 | }, data || {});
|
50 |
|
51 | return eventBus.createEvent(data);
|
52 | });
|
53 | } |
\ | No newline at end of file |