-
Notifications
You must be signed in to change notification settings - Fork 0
/
6-文本3-dominant-baseline + alignment-baseline.html
153 lines (114 loc) · 3.12 KB
/
6-文本3-dominant-baseline + alignment-baseline.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!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>
ul li{
margin-bottom: 20px;
cursor: pointer;
}
/*高亮效果*/
.highlight{
stroke:#1470FA;
}
</style>
<!--
-->
<body>
<svg width="300" height="300" viewBox="0 0 300 120"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<!--放三排文字
是定位的坐标 和其他图形一样,都位于左上角
-->
<text dominant-baseline ="text-before-edge" alignment-baseline="before-edge"
x="60" y="10">我是个测试文字 up</text>
<text dominant-baseline ="text-before-edge" alignment-baseline="before-edge"
x="60" y="60"></text>
<text dominant-baseline ="text-before-edge" alignment-baseline="before-edge"
x="60" y="110">我是个测试文字 down</text>
<!--这个是对比--->
<text x="60" y="160">A aaa</text>
<!-- 参考线 -->
<line x1="60" y1="10" x2="400" y2="10" style="stroke:rgb(255,0,0);stroke-width:2"></line>
<line x1="60" y1="60" x2="400" y2="60" style="stroke:rgb(255,0,0);stroke-width:2"></line>
<line x1="60" y1="110" x2="400" y2="110" style="stroke:rgb(255,0,0);stroke-width:2"></line>
<line x1="60" y1="160" x2="400" y2="160" style="stroke:rgb(255,0,0);stroke-width:2"></line>
<!-- 参考点 -->
<circle cx="60" cy="10" r="3" fill="red" />
<circle cx="60" cy="60" r="3" fill="red" />
<circle cx="60" cy="110" r="3" fill="red" />
<circle cx="60" cy="160" r="3" fill="red" />
<style><![CDATA[
<style><![CDATA[
text{
font: bold 36px Verdana, Helvetica, Arial, sans-serif;
}
]]></style>
</svg>
</body>
<script>
/**
* 涂改文字
*/
function changeText(){
var v = $("#id-text").textbox("getValue");
// alert(v);
t.text(v);
}
/**
* 清空文字
*/
function clearText(){
t.clear();
}
/**
* 变色
*/
function changeColor(){
t.style("fill",getRandomColor());
}
function changeSize(){
var a = Math.floor(Math.random()*100);
t.font("size",a);
}
/**
* 加载图例
*/
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>