-
Notifications
You must be signed in to change notification settings - Fork 0
/
13-layer2.html
107 lines (69 loc) · 1.9 KB
/
13-layer2.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="svg270/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="svg270/themes/icon.css">
<script type="text/javascript" src="svg270/jquery.min.js"></script>
<script type="text/javascript" src="svg270/jquery.easyui.min.js"></script>
<script src="svg270/svg.min.js"></script>
<script src="svg270/svg.panzoom.js"></script>
<script src="svg270/svg.draggable.js"></script>
<link rel="stylesheet" type="text/css" href="svg270/svg.select.css">
<script src="svg270/svg.select.js"></script>
<script src="svg270/svg.resize.js"></script>
</head>
<style>
</style>
<!--
-->
<body>
<div>
<div style="border-bottom: 1px solid gray;">我是一个画布视窗</div>
<div id="drawing" style="border:2px solid green;width: 800px;height: 600px;">
</div>
</div>
</body>
<script>
var draw = SVG('drawing');
//red
var r1 = draw.rect(100, 100).style({"fill":"red","stroke-width":"0.5mm"});
//green
var r2 = draw.rect(100, 100).dmove(70,20).style({"fill":"green","stroke-width":"0.5mm"});
//blue
var r3 = draw.rect(100, 100).dmove(50,50).style({"fill":"blue"});
//初始状态: blue -> red -> green
//放置最底部
//r3.back();
//放置最上部
r1.front();
/**
* 加载图例
*/
function loadLegendByUrl(url, callback) {
$.post(url, {}, function (data) {
if ($.isFunction(callback)) {
callback(data);
}
}, "text");
}
function createUUID() {
var x = 13 * Math.floor(Math.random() * 1000) + "-" + 7 * Math.floor(Math.random() * 100);
return "id_" + x;
}
/**
* 生成随机颜色
*/
function getRandomColor() {
var x = getRandomInteger();
return "#" + x;
}
/**
* 生成随机数
*/
function getRandomInteger() {
var x = Math.floor(Math.random() * 9) + "" + Math.floor(Math.random() * 9) + "" + Math.floor(Math.random() * 9);
return x;
}
</script>
</html>