This repository has been archived by the owner on Jan 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.html
76 lines (62 loc) · 1.49 KB
/
test.html
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!doctype html>
<meta charset="utf-8"/>
<title>Connection-line tests</title>
<style>
body {
/*margin: 0;*/
min-height: 800px;
}
.a, .b, .c, .d {
width: 40px;
height: 40px;
outline: 1px solid lightgray;
}
.a {
}
.b {
margin-top: 20px;
}
.c {
position: relative;
top: 100px;
left: 100px;
}
.d {
position: absolute;
top: 0px;
left: 200px;
}
connection-line{
/*outline: 1px solid red;*/
}
</style>
<script src="./bundle.js"></script>
<link rel="import" href="."/>
<div class="a">A</div>
<div class="b">B</div>
<div class="c">C
<div class="d">D</div>
<connection-line from=".a" to=".b"></connection-line>
</div>
<connection-line from=".b" to=".d" line-end="➤" line-middle="✘"></connection-line>
<connection-line from=".a" to=".a" from-direction="right" to-direction="bottom"></connection-line>
<connection-line from="0, 0" to=".a" to-direction="bottom"></connection-line>
<connection-line from=".d" to=".c" line-end=""></connection-line>
<script type="text/javascript">
var Draggy = require('draggy');
var Resizable = require('resizable');
var els = document.querySelectorAll('.a, .b, .c, .d');
var connectors = [].slice.call(document.querySelectorAll('connection-line'));
for (var i = 0; i < els.length; i++ ){
Draggy(els[i]).on('drag', function () {
connectors.forEach(function (connector) {
connector.update();
})
})
// Resizable(els[i]).on('resize', function () {
// connectors.forEach(function (connector) {
// connector.update();
// })
// });
}
</script>