Revision 92
updated vertex conditions
lab4/state_machine.c | ||
---|---|---|
90 | 90 |
break; |
91 | 91 |
case VERTEX: |
92 | 92 |
if (event->type == MOUSE_MOV) { |
93 |
if (abs(event->delta_x) > tolerance || abs(event->delta_y) > tolerance) |
|
93 |
x_length += event->delta_x; |
|
94 |
y_length += event->delta_y; |
|
95 |
if (abs(x_length) > tolerance || abs(y_length) > tolerance) { |
|
94 | 96 |
state = INITIAL; |
97 |
x_length = 0; |
|
98 |
y_length = 0; |
|
99 |
} |
|
95 | 100 |
} else if (event->type == RB_PRESSED) { |
96 | 101 |
state = DRAG_DOWN; |
102 |
x_length = 0; |
|
103 |
y_length = 0; |
|
97 | 104 |
} else if (event->type == LB_PRESSED) { |
98 | 105 |
state = DRAG_UP; |
99 |
} else |
|
106 |
x_length = 0; |
|
107 |
y_length = 0; |
|
108 |
} else { |
|
100 | 109 |
state = INITIAL; |
110 |
x_length = 0; |
|
111 |
y_length = 0; |
|
112 |
} |
|
101 | 113 |
break; |
102 | 114 |
case DRAG_DOWN: |
103 | 115 |
if (event->type == MOUSE_MOV) { |
Also available in: Unified diff