Revision 16752
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/MoveBehavior.java | ||
---|---|---|
62 | 62 |
private Point2D m_LastPoint; |
63 | 63 |
private Point2D m_PointAnt; |
64 | 64 |
private PanListener listener; |
65 |
private boolean isButton1; |
|
65 | 66 |
|
66 | 67 |
/** |
67 | 68 |
* Crea un nuevo MoveBehavior. |
... | ... | |
81 | 82 |
g.setColor(Color.WHITE); |
82 | 83 |
else |
83 | 84 |
g.setColor(theBackColor); |
84 |
|
|
85 |
|
|
85 | 86 |
g.setColor(getMapControl().getMapContext().getViewPort().getBackColor()); |
86 | 87 |
g.fillRect(0, 0, getMapControl().getWidth(), getMapControl().getHeight()); |
87 | 88 |
|
... | ... | |
106 | 107 |
*/ |
107 | 108 |
public void mousePressed(MouseEvent e) { |
108 | 109 |
Point pScreen = e.getPoint(); |
109 |
|
|
110 |
|
|
110 | 111 |
m_PointAnt = pScreen; |
111 | 112 |
m_FirstPoint = m_PointAnt; |
112 |
|
|
113 | 113 |
if (e.getButton() == MouseEvent.BUTTON1) { |
114 |
isButton1=true; |
|
114 | 115 |
m_PointAnt = pScreen; |
115 |
m_FirstPoint = m_PointAnt; |
|
116 |
|
|
117 |
}else{ |
|
118 |
isButton1=false; |
|
116 | 119 |
} |
117 | 120 |
|
118 | 121 |
if (listener.cancelDrawing()) { |
... | ... | |
128 | 131 |
* @throws BehaviorException Excepci?n lanzada cuando el Behavior. |
129 | 132 |
*/ |
130 | 133 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
131 |
Point2D p1; |
|
132 |
Point2D p2; |
|
133 |
|
|
134 |
if (e.getButton() == MouseEvent.BUTTON1) { |
|
134 |
if (e.getButton() == MouseEvent.BUTTON1 && m_FirstPoint!=null) { |
|
135 | 135 |
MoveEvent event = new MoveEvent(m_FirstPoint, e.getPoint(), e); |
136 | 136 |
listener.move(event); |
137 | 137 |
|
... | ... | |
148 | 148 |
* @param e MouseEvent |
149 | 149 |
*/ |
150 | 150 |
public void mouseDragged(MouseEvent e) { |
151 |
m_LastPoint = e.getPoint(); |
|
152 |
getMapControl().repaint(); |
|
151 |
if (isButton1){ |
|
152 |
m_LastPoint = e.getPoint(); |
|
153 |
getMapControl().repaint(); |
|
154 |
} |
|
153 | 155 |
} |
154 | 156 |
|
155 | 157 |
/** |
Also available in: Unified diff