-
Notifications
You must be signed in to change notification settings - Fork 0
/
VBar.pde
48 lines (41 loc) · 874 Bytes
/
VBar.pde
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
class VBar extends View {
ListBox myList;
VBar(float x_, float y_, float w_, float h_, ListBox theList)
{
super(x_, y_, w_, h_);
myList = theList;
}
float start()
{
return map(myList.myListCounter, 0, myList.maxScroll(), 0, h-14);
}
void setStart(float start)
{
myList.myListCounter = (int)map(start, 0, h-14, 0, myList.maxScroll());
}
void drawContent()
{
noFill();
stroke(0);
fill(255);
rect(0, 0, w, h);
fill(128);
rect(0, start(), w, 14);
}
boolean contentPressed(float lx, float ly)
{
if((ly <= h -7) && (ly >= 7)){
setStart(ly - 7);
}
println(myList.myListCounter);
return true;
}
boolean contentDragged(float lx, float ly)
{
if((ly <= h -7) && (ly >= 7)){
setStart(ly - 7);
}
println(myList.myListCounter);
return true;
}
}