Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 58 lines (46 sloc) 1.141 kB
95ab44d @pjimen5 SighingsDetailsViewUpdates
pjimen5 authored
1
2 color vScrollColor = 255;
3 color buttonsvScrollColor = 255;
4
5 class VScroll extends View {
6 int currentLine;
7 int linesCount;
8 int linesXSpace;
460582b @pjimen5 VScrollUpdates
pjimen5 authored
9 float _y = 0;
10 float _h = 12;
494c5aa @pjimen5 VScrollupdates+FixedRetrievedDatefromDB
pjimen5 authored
11
95ab44d @pjimen5 SighingsDetailsViewUpdates
pjimen5 authored
12 VScroll(float x_, float y_, float w_, float h_)
13 {
14 super(x_, y_, w_, h_);
15 linesCount = currentLine = 1;
16 }
17
494c5aa @pjimen5 VScrollupdates+FixedRetrievedDatefromDB
pjimen5 authored
18 void setCurrentLine (int _value){
19 currentLine = 0;
20 _y=0;
21 }
22
95ab44d @pjimen5 SighingsDetailsViewUpdates
pjimen5 authored
23 void drawContent()
24 {
ca234c3 @pjimen5 FewUpdates
pjimen5 authored
25
95ab44d @pjimen5 SighingsDetailsViewUpdates
pjimen5 authored
26 if (linesCount > linesXSpace){
27 noFill();
28 stroke(vScrollColor);
29 line(0, 0,0,h);
30 fill(vScrollColor);
460582b @pjimen5 VScrollUpdates
pjimen5 authored
31 // float _y = map(currentLine*linesXSpace,0,linesCount,0,linesXSpace);
32 // float _h = map(linesXSpace,linesXSpace,linesCount,5,h);
33 rect(0,constrain(_y-6,0,h-12), w, _h);
95ab44d @pjimen5 SighingsDetailsViewUpdates
pjimen5 authored
34 }
35 }
36
37 boolean contentPressed(float lx, float ly)
38 {
460582b @pjimen5 VScrollUpdates
pjimen5 authored
39 _y = ly;
95ab44d @pjimen5 SighingsDetailsViewUpdates
pjimen5 authored
40 if (linesCount > linesXSpace){
41
460582b @pjimen5 VScrollUpdates
pjimen5 authored
42 currentLine = constrain(int(map(ly,0,h,0,linesCount-1)),0,linesCount-1);
95ab44d @pjimen5 SighingsDetailsViewUpdates
pjimen5 authored
43 }
44 return true;
45 }
46
47 boolean contentDragged(float lx, float ly)
48 {
460582b @pjimen5 VScrollUpdates
pjimen5 authored
49 _y = ly;
95ab44d @pjimen5 SighingsDetailsViewUpdates
pjimen5 authored
50 if (linesCount > linesXSpace){
460582b @pjimen5 VScrollUpdates
pjimen5 authored
51 currentLine = constrain(int(map(ly,0,h,0,linesCount-1)),0,linesCount-1);
95ab44d @pjimen5 SighingsDetailsViewUpdates
pjimen5 authored
52
53 }
54 return true;
55 }
56 }
57
Something went wrong with that request. Please try again.