-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.php
More file actions
164 lines (141 loc) · 5.28 KB
/
Copy pathtext.php
File metadata and controls
164 lines (141 loc) · 5.28 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
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
154
155
156
157
158
159
160
161
162
163
164
<?php include 'includes/head.php'; ?>
<?php include 'includes/nav.php'; ?>
<div class="row">
<div class="span3">
<h3>Red Rectangle</h3>
Type:
<div class="btn-group">
<button class="btn" onclick="setType(redRect,'center')">center</button>
<button class="btn" onclick="setType(redRect,'inner')">inner</button>
<button class="btn" onclick="setType(redRect,'outer')">outer</button>
</div>
<br>
X:
<div class="btn-group">
<button class="btn" onclick="setX(redRect,'center')">center</button>
<button class="btn" onclick="setX(redRect,'left')">left</button>
<button class="btn" onclick="setX(redRect,'right')">right</button>
</div>
<br>
Y:
<div class="btn-group">
<button class="btn" onclick="setY(redRect,'center')">center</button>
<button class="btn" onclick="setY(redRect,'top')">top</button>
<button class="btn" onclick="setY(redRect,'bottom')">bottom</button>
</div>
</div>
<div class="span3">
<h3>Blue Rectangle</h3>
Type:
<div class="btn-group">
<button class="btn" onclick="setType(blueRect,'center')">center</button>
<button class="btn" onclick="setType(blueRect,'inner')">inner</button>
<button class="btn" onclick="setType(blueRect,'outer')">outer</button>
</div>
<br>
X:
<div class="btn-group">
<button class="btn" onclick="setX(blueRect,'center')">center</button>
<button class="btn" onclick="setX(blueRect,'left')">left</button>
<button class="btn" onclick="setX(blueRect,'right')">right</button>
</div>
<br>
Y:
<div class="btn-group">
<button class="btn" onclick="setY(blueRect,'center')">center</button>
<button class="btn" onclick="setY(blueRect,'top')">top</button>
<button class="btn" onclick="setY(blueRect,'bottom')">bottom</button>
</div>
</div>
<div class="span3">
<h3>Text</h3>
Text: <textarea onchange="text.string=this.value"></textarea>
Text Align:
<div class="btn-group">
<button class="btn" onclick="setTextAlign(text,'center')">center</button>
<button class="btn" onclick="setTextAlign(text,'left')">left</button>
<button class="btn" onclick="setTextAlign(text,'right')">right</button>
</div>
<br>
Type:
<div class="btn-group">
<button class="btn" onclick="setType(text,'center')">center</button>
<button class="btn" onclick="setType(text,'inner')">inner</button>
<button class="btn" onclick="setType(text,'outer')">outer</button>
</div>
<br>
X:
<div class="btn-group">
<button class="btn" onclick="setX(text,'center')">center</button>
<button class="btn" onclick="setX(text,'left')">left</button>
<button class="btn" onclick="setX(text,'right')">right</button>
</div>
<br>
Y:
<div class="btn-group">
<button class="btn" onclick="setY(text,'center')">center</button>
<button class="btn" onclick="setY(text,'top')">top</button>
<button class="btn" onclick="setY(text,'bottom')">bottom</button>
</div>
</div>
</div>
<canvas id="stage" width="800" height="500"></canvas>
<script src="js/grafix.nocache.js"></script>
<script>
Grafix.import();
function setX( rect, x ) {
rect.alignData.x = x;
rect.align = rect.alignData.align;
}
function setY( rect, y ) {
rect.alignData.y = y;
rect.align = rect.alignData.align;
}
function setType( rect, type ) {
rect.alignData.type = type;
rect.align = rect.alignData.align;
}
function setTextAlign( text, align ) {
text.textAlign = align;
}
var stage = new Stage( '#stage' );
stage.color = Color.black;
var redRect = new Rectangle( { width: 400, height: 400, color: 'red' } ),
blueRect = new Rectangle( { width: 250, height: 250, color: 'blue' } ),
text = new Text( {
string: "Test\nand also\nmultiline! :)",
textAlign: 'center',
color: 'white',
width: blueRect.width
} );
redRect.alignData = {
x: 'center',
y: 'center',
type: 'center',
get align() {
return [ this.x, this.y, this.type ].join( ' ' );
}
};
blueRect.alignData = {
x: 'center',
y: 'center',
type: 'center',
get align() {
return [ this.x, this.y, this.type ].join( ' ' );
}
};
text.alignData = {
x: 'center',
y: 'center',
type: 'center',
get align() {
return [ this.x, this.y, this.type ].join( ' ' );
}
};
stage.addChild( redRect.addChild( blueRect.addChild( text ) ) );
redRect.align = redRect.alignData.align;
blueRect.align = blueRect.alignData.align;
text.align = text.alignData.align;
stage.start( true );
</script>
<?php include 'includes/foot.php'; ?>