/
ys_touch.pde
70 lines (60 loc) · 2.03 KB
/
ys_touch.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
void touchDown(int ID, float xPos, float yPos, float xWidth, float yWidth) {
if (currentPage == FIRST_PAGE) {
if (ui.getFirstPage().getIsSelecting() == false && ui.getFirstPage().getDisplayMode() == YEAR_MODE && ui.getLeftBar().getIsDisplay() == false) {
if (yPos <= ui.getFirstPage().getRange().getY_High() + 4*scale && yPos >= ui.getFirstPage().getRange().getY_Low() - 4*scale ) {
if (xPos >= ui.getFirstPage().getRange().getX_L() && xPos <= ui.getFirstPage().getRange().getX_R()) {
if (isLeftLockCloser(xPos) == true) {
global_isDragLeft = true;
}
else global_isDragRight = true;
}
}
}
ui.updateFirstPage(xPos, yPos);
}
else if (currentPage == MONSTER_PAGE) {
ui.getMonsterPage().mousePressed_(xPos, yPos);
}
else if (currentPage == MOVIE_PAGE) {
ui.getMoviePage().mousePressed_(xPos, yPos);
}
}
void touchUp(int ID, float xPos, float yPos, float xWidth, float yWidth) {
global_isDragLeft = false;
global_isDragRight = false;
ui.updateLeftBar(xPos, yPos);
//
if (currentPage == FIRST_PAGE) {
}
else if (currentPage == MONSTER_PAGE) {
ui.getMonsterPage().mouseReleased_(xPos, yPos);
}
else if (currentPage == MOVIE_PAGE) {
ui.getMoviePage().mouseReleased_(xPos, yPos);
}
}
void touchMove(int ID, float xPos, float yPos, float xWidth, float yWidth) {
if (currentPage == FIRST_PAGE) {
if (global_isDragLeft) {
ui.getFirstPage().updateRangeL(xPos);
//println("update");
}
if (global_isDragRight) {
ui.getFirstPage().updateRangeR(xPos);
//println("update");
}
}
if (currentPage == MONSTER_PAGE) {
ui.getMonsterPage().mouseDragged_(xPos, yPos);
}
else if (currentPage == MOVIE_PAGE) {
ui.getMoviePage().mouseDragged_(xPos, yPos);
}
}// touchMove
boolean isLeftLockCloser(float x) {
float l = x - ui.getFirstPage().getRange().getLeftLock().getX();
float r = x - ui.getFirstPage().getRange().getRightLock().getX();
if (l<0) l = -l;
if (r<0) r = -r;
return (l<r)? true:false;
}