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 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | export function createEvent(target, position, data) {
|
47 |
|
48 | return getBpmnJS().invoke(function(eventBus) {
|
49 | data = assign({
|
50 | target: target,
|
51 | x: position.x,
|
52 | y: position.y,
|
53 | clientX: position.x,
|
54 | clientY: position.y,
|
55 | offsetX: position.x,
|
56 | offsetY: position.y,
|
57 | button: 0
|
58 | }, data || {});
|
59 |
|
60 | return eventBus.createEvent(data);
|
61 | });
|
62 | } |
\ | No newline at end of file |