litesoft
Diff Revisions
947
vs
948
for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/nonpublic/DragPositionableController.java
|
@@ -1,39 +1,31 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
2 |
|
package org.litesoft.GWT.client.widgets.nonpublic; |
3 |
3 |
|
|
4 |
|
- |
public class DragPositionableController extends AbstractMovable |
5 |
|
- |
{ |
6 |
|
- |
public DragPositionableController( UiPositionable pTarget ) |
7 |
|
- |
{ |
|
4 |
+ |
public class DragPositionableController extends AbstractMovable { |
|
5 |
+ |
public DragPositionableController( UiPositionable pTarget ) { |
8 |
6 |
|
super( pTarget ); |
9 |
7 |
|
} |
10 |
8 |
|
|
11 |
9 |
|
@Override |
12 |
|
- |
protected boolean dragBy( int pDeltaX, int pDeltaY ) |
13 |
|
- |
{ |
|
10 |
+ |
protected boolean dragBy( int pDeltaX, int pDeltaY ) { |
14 |
11 |
|
getTarget().setPosition( calcNewPos( "X", getTarget().getPosLeft(), pDeltaX, // |
15 |
12 |
|
getTarget().minPosLeft(), getTarget().maxPosLeft() ), calcNewPos( "Y", getTarget().getPosTop(), pDeltaY, // |
16 |
|
- |
getTarget().minPosTop(), getTarget().maxPosTop() ) ); |
|
13 |
+ |
getTarget().minPosTop(), |
|
14 |
+ |
getTarget().maxPosTop() ) ); |
17 |
15 |
|
return true; |
18 |
16 |
|
} |
19 |
17 |
|
|
20 |
18 |
|
/** |
21 |
19 |
|
* @noinspection UnusedDeclaration |
22 |
20 |
|
*/ |
23 |
|
- |
private int calcNewPos( String pOrientation, int pCurrentPosition, int pDelta, int pMinimumPosition, int pMaximumPosition ) |
24 |
|
- |
{ |
|
21 |
+ |
private int calcNewPos( String pOrientation, int pCurrentPosition, int pDelta, int pMinimumPosition, int pMaximumPosition ) { |
25 |
22 |
|
int zNewPosition = pCurrentPosition; |
26 |
|
- |
if ( pDelta < 0 ) |
27 |
|
- |
{ |
28 |
|
- |
if ( (zNewPosition += pDelta) < pMinimumPosition ) |
29 |
|
- |
{ |
|
23 |
+ |
if ( pDelta < 0 ) { |
|
24 |
+ |
if ( (zNewPosition += pDelta) < pMinimumPosition ) { |
30 |
25 |
|
zNewPosition = pMinimumPosition; |
31 |
26 |
|
} |
32 |
|
- |
} |
33 |
|
- |
else if ( (pDelta > 0) && (pMaximumPosition > 0) ) |
34 |
|
- |
{ |
35 |
|
- |
if ( (zNewPosition += pDelta) > pMaximumPosition ) |
36 |
|
- |
{ |
|
27 |
+ |
} else if ( (pDelta > 0) && (pMaximumPosition > 0) ) { |
|
28 |
+ |
if ( (zNewPosition += pDelta) > pMaximumPosition ) { |
37 |
29 |
|
zNewPosition = pMaximumPosition; |
38 |
30 |
|
} |
39 |
31 |
|
} |