-
Notifications
You must be signed in to change notification settings - Fork 0
/
17-marker.html
90 lines (61 loc) · 2.09 KB
/
17-marker.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
<!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="svg311/node_modules/@svgdotjs/svg.js/dist/svg.js"></script>
<script src="svg311/node_modules/@svgdotjs/svg.panzoom.js/dist/svg.panzoom.js"></script>
<script src="svg311/node_modules/@svgdotjs/svg.draggable.js/dist/svg.draggable.js"></script>
<!-- 低版本 -->
<!-- <script src="svg270/svg.min.js"></script>
<script src="svg270/svg.panzoom.js"></script>
<script src="svg270/svg.draggable.js"></script> -->
</head>
<style>
</style>
<!--
-->
<body>
<div>
<div style="">我是一个画布视窗</div>
<svg width="120" height="120" viewBox="0 0 120 120"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs>
<marker id="Triangle" viewBox="0 0 10 10" refX="1" refY="5"
markerWidth="6" markerHeight="10" orient="auto">
<path d="M 0 0 L 10 5 L 0 10 z" />
</marker>
</defs>
<polyline points="10,90 50,80 90,20 100,100" fill="none" stroke="black"
stroke-width="2" marker-end="url(#Triangle)" marker-mid="url(#Triangle)"/>
</svg>
</div>
</body>
<script>
var draw = SVG().addTo('#drawing').size("100%","100%");
//draw.path("M100 100 H200 V300 L 400 250").css({"fill":"none","stroke":"green","stroke-width":"1mm"});
draw.path('M 100 200 L 300 100 L 200 300').css({"fill":"none","stroke":"green","stroke-width":"1mm"});
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>