-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_fixed.html
More file actions
47 lines (43 loc) · 1.5 KB
/
test_fixed.html
File metadata and controls
47 lines (43 loc) · 1.5 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Hello Qunee for HTML5</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body style="margin: 0px">
<div style="position: absolute; width: 100%; top: 0px; bottom: 0px;" id="canvas"></div>
<script src="http://demo.qunee.com/lib/qunee-min.js"></script>
<script>
var graph = new Q.Graph('canvas');
var hello = graph.createNode("Hello", 100, 50);
hello.image = Q.Graphs.server;
var qunee = graph.createNode("Qunee", 100, 150);
var edge = graph.createEdge("Hello\nQunee", hello, qunee);
var oldLocation;
graph.interactionDispatcher.addListener(function (evt) {
var data = evt.data;//当前鼠标点位置的图元
var datas = evt.datas; //所有拖动的图元
if (evt.kind == Q.InteractionEvent.ELEMENT_MOVE_START) {
oldLocation = {};
datas.forEach(function(data){
oldLocation[data.id] = {x: data.x, y: data.y};
})
return;
}
if (evt.kind == Q.InteractionEvent.ELEMENT_MOVING) {
datas.forEach(function(data){
if(data instanceof Q.Node){
data.y = graph.ty;
}
})
return;
}
if (evt.kind == Q.InteractionEvent.ELEMENT_MOVE_END) {
oldLocation = null;
}
})
</script>
</body>
</html>