|
@@ -11,15 +11,24 @@ void SlopState::update( SlopMemory& memory, double dt ) {
|
11
|
11
|
void SlopState::draw( SlopMemory& memory, glm::mat4 matrix ) {
|
12
|
12
|
}
|
13
|
13
|
|
14
|
|
-// Start
|
|
14
|
+void SlopStart::onEnter( SlopMemory& memory ) {
|
|
15
|
+ setStartPos = false;
|
|
16
|
+}
|
15
|
17
|
void SlopStart::update( SlopMemory& memory, double dt ) {
|
16
|
|
- if ( mouse->getButton( 1 ) ) {
|
17
|
|
- memory.setState( (SlopState*)new SlopStartDrag( mouse->getMousePos() ) );
|
|
18
|
+ if ( mouse->getButton( 1 ) && !setStartPos ) {
|
|
19
|
+ startPos = mouse->getMousePos();
|
|
20
|
+ setStartPos = true;
|
|
21
|
+ }
|
|
22
|
+ if ( setStartPos && glm::distance( startPos, mouse->getMousePos() ) > 4 ) {
|
|
23
|
+ memory.setState( (SlopState*)new SlopStartDrag( startPos ) );
|
18
|
24
|
}
|
19
|
25
|
if ( mouse->hoverWindow != None ) {
|
20
|
26
|
glm::vec4 rect = getWindowGeometry( mouse->hoverWindow, true );
|
21
|
27
|
memory.rectangle->setPoints( glm::vec2( (float)rect.x, (float)rect.y ), glm::vec2( (float)rect.x+rect.z, (float)rect.y+rect.w ) );
|
22
|
28
|
}
|
|
29
|
+ if ( setStartPos && !mouse->getButton( 1 ) ) {
|
|
30
|
+ memory.setState( (SlopState*)new SlopEndDrag() );
|
|
31
|
+ }
|
23
|
32
|
}
|
24
|
33
|
|
25
|
34
|
void SlopStart::draw( SlopMemory& memory, glm::mat4 matrix ) {
|