This repository was archived by the owner on Apr 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprototype_carrousel.html
More file actions
281 lines (221 loc) · 8.12 KB
/
Copy pathprototype_carrousel.html
File metadata and controls
281 lines (221 loc) · 8.12 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mobile Widgets</title>
<link rel="stylesheet" href="style/style.css" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<script type="text/javascript" src="js/StructureElts.js"></script>
<script type="text/javascript" src="js/Structure.js"></script>
<script type="text/javascript" src="js/DocElements.js"></script>
</head>
<body>
<script type="text/javascript">
<!--
idCurrentPage = "prototype_carrousel";
beginPage();
//-->
</script>
<h1 class="title">Carrousel prototype</h1>
<script type="text/javascript">
<!--
addIndex();
//-->
</script>
<img class="right" alt="MenuBar" src="images/prototypes/proto_carrousel_01.jpg" />
<script type="text/javascript">addTitle("Introduction", 1);</script>
<p>
This prototype displays any number of items in a zoom effect on the item which is selected.<br/>
Each item is composed of:
</p>
<ul>
<li>a label</li>
<li>an icon and its optional background image</li>
<li>a notification and its optional icon image</li>
</ul>
<p>
In case the images use online resources, default images and error images can be defined for each item to handle failure properly.<br/>
</p>
<br/>
<script type="text/javascript">addTitle("Interface", 1);</script>
<textarea rows="15" cols="50" readonly="readonly" wrap="off">
PROTO Carrousel [
# Events
eventIn SFBool update
exposedField SFBool startZoom FALSE # Set to TRUE to zoom in and to FALSE to zoom out
exposedField SFInt32 index 0
exposedField SFBool enable TRUE
exposedField SFBool available TRUE # will be set to FALSE when a scroll animation is ongoing
eventOut SFBool zoomFinished # will be set to TRUE on end of zoom in and to FALSE on end of zoom out
eventOut SFString activeKey # Send touchCursor event to upper prototypes
# Data
field MFString images []
field MFString labels []
field MFString notifs []
field MFString bgIcons []
field MFString notifIcons []
field MFString defaultIcons []
field MFString errorIcons []
# Style
field SFBool cycle TRUE # if TRUE, at display carrousel as a circle
field SFVec2f screenSize 0 0
field SFVec2f textScale 1 1
field MFString style "Carrousel"
field MFString itemStyle "Carrousel-item"
field MFString notifStyle "Carrousel-notif"
field MFString panelStyle "Carrousel-panel"
field MFString imagesStyle ["" "carrouselArrowLeft.png" "carrouselArrowLeft_over.png" "carrouselArrowRight.png" "carrouselArrowRight_over.png"]
]
</textarea>
<br/>
<script type="text/javascript">addTitle("Fields description", 1);</script>
<h2>Data fields</h2>
<ul>
<li>MFString images - Icons of each item</li>
<li>MFString labels - Labels of each item</li>
<li>MFString notifs - Labels of the notifications</li>
<li>MFString bgIcons - Background images placed behind the icons of each item</li>
<li>MFString notifIcons - Icons of the notifications, can be used as a background image to the notification labels</li>
<li>MFString defaultIcons - Default icons, displayed while the icon is loading</li>
<li>MFString errorIcons - Error icons, displayed if the icon loading fails</li>
</ul>
<br/>
<h2>Style fields</h2>
<ul>
<li>SFBool cycle - If TRUE, at display carrousel as circle</li>
<li>SFVec2f screenSize - Size of the screen where the application is displayed</li>
<li>SFVec2f textScale - Use for scaling text if necessary (phone with small fonts)</li>
<li>MFString style - Path to the CSS node associated to Carrousel proto</li>
<li>MFString itemStyle - Path to the specific CSS node Carrousel Item</li>
<li>MFString notifStyle - Path to the specific CSS node Carrousel Notification</li>
<li>MFString panelStyle - Path to the specific CSS node Carrousel Panel</li>
<li>MFString imagesStyle - Images used to display the panel background and both panel arrows (and their pressed states)</li>
</ul>
<br/>
<h2>Exposed Fields</h2>
<ul>
<li>SFBool available - Set to FALSE when a scroll animation is ongoing</li>
<li>SFBool enable - Enable/disable Carrousel</li>
<li>SFInt32 index - Index of the current element</li>
</ul>
<br/>
<h2>Event in</h2>
<ul>
<li>SFBool update - Update the Carrousel and position its index on the given element</li>
<li>SFBool startZoom - Set to TRUE to zoom in and to FALSE to zoom out. It set to FALSE by default: the carrousel is not visible !</li>
</ul>
<br/>
<h2>Event Out</h2>
<ul>
<li>SFBool zoomFinished - Set to TRUE on end of zoom in and to FALSE on end of zoom out</li>
<li>SFString activeKey - Send touchCursor event to upper prototypes</li>
</ul>
<br/>
<script type="text/javascript">addTitle("CSS", 1);</script>
<textarea rows="15" cols="80" readonly="readonly" wrap="off">
Carrousel {
position: 0% 20%;
size: 100% 75%;
}
Carrousel-item {
size: 30% 30%; // size of the main icon (keeping aspect ratio)
scale: 70%; // ratio between size of main and second items, ignored when on light mode
image-position: 0% -15%; // position of the image background (relative to Carrousel-item.size)
image-size: 34.5% 44%; // size of the image background (keeping aspect ratio)
text-position: 50% -50%; // position of the notification, (relative to Carrousel-item.size)
text-size: 12.5% 16.666%; // size of the image notification (keeping aspect ratio)
vertical-align: BASELINE;
horizontal-align: MIDDLE;
color: white;
}
Carrousel-panel {
// panel properties
position: 0% -25%;
size: 90% 20%;
background-color: #e9e9e9; // light-gray
// controls properties
image-position: 40% 0%; // position of the right arrow
image-size: 4.58% 8.75%; // size of the left/right arrows
// label properties
text-size: 70% 2px; // width is relative to screen, height is the number of lines to wrap
color: black;
vertical-align: MIDDLE;
horizontal-align: MIDDLE;
font-size: 18;
font-filter: true;
}
</textarea>
<br/>
<script type="text/javascript">addTitle("Extern proto(s)", 1);</script>
<p>
CarrouselIcon, TouchCursor
</p>
<br/>
<script type="text/javascript">addTitle("Example", 1);</script>
<textarea rows="15" cols="80" readonly="readonly" wrap="off">
EXTERNPROTO Carrousel [] "Carrousel.wrl"
EXTERNPROTO SizeNotifier [] "SizeNotifier.wrl"
Group {
children [
Style {
url ["default.css"]
}
DEF SIZE_NOTIFIER SizeNotifier {}
Shape {
appearance Appearance {
material Material2D { emissiveColor 1 1 1 }
}
geometry DEF BACKGROUND Rectangle {
size 10 10
}
}
DEF KEY_SENSOR KeySensor {
url "LR"
activate TRUE
repeatInterval 0.25
repeatDelay 1
}
DEF CAROUSEL Carrousel {
labels [ "Item 1" "Item 2" "Item 3" "Item 4" "Item 5" ]
}
DEF SCRIPT Script {
eventIn SFTime keyPressed
field SFNode carousel USE CAROUSEL
field SFNode input USE KEY_SENSOR
url "
function keyPressed () {
Browser.print('Key pressed: ' + input.activeKey);
if (input.activeKey == 'R') {
carousel.index = carousel.index + 1;
if (carousel.index > 4) carousel.index = 0;
carousel.update = true;
} else {
carousel.index = carousel.index - 1;
if (carousel.index < 0) carousel.index = 4;
carousel.update = true;
}
}
"
}
ROUTE SIZE_NOTIFIER.screenSize TO BACKGROUND.size
ROUTE SIZE_NOTIFIER.screenSize TO CAROUSEL.screenSize
ROUTE SIZE_NOTIFIER.textScale TO CAROUSEL.textScale
ROUTE KEY_SENSOR.pressTime TO SCRIPT.keyPressed
]
}
</textarea>
<br/>
<script type="text/javascript">
<!--
addBackPageNavigator ('widgets_development_prototypes','');
//-->
</script>
<script type="text/javascript">
<!--
endPage();
//-->
</script>
</body>
</html>