Revision 41974

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/tools/Behavior/MoveBehavior.java
64 64
     * @see #setListener(ToolListener)
65 65
     */
66 66
    private PanListener listener;
67
    private boolean isMyButton;
68 67

  
69 68
    /**
70 69
     * <p>
......
87 86

  
88 87
    @Override
89 88
    public void paintComponent(MapControlDrawer renderer) {
89
        if( ! this.isMyButton() ) {
90
            return;
91
        }
90 92
        super.paintComponent(renderer);
91 93
        BufferedImage image = getMapControl().getImage();
92 94
        if (image != null) {
......
102 104

  
103 105
    @Override
104 106
    public void mousePressed(MouseEvent e) {
105
        if (isMyButton(e)) {
106
            isMyButton = true;
107
        if (this.isMyButton(e)) {
107 108
            m_FirstPoint = e.getPoint();
108 109
            if (listener.cancelDrawing()) {
109 110
               getMapControl().cancelDrawing();
......
115 116

  
116 117
    @Override
117 118
    public void mouseReleased(MouseEvent e) throws BehaviorException {
118
        if (isMyButton(e) && m_FirstPoint != null) {
119
        if (this.isMyButton(e) && m_FirstPoint != null) {
119 120
            doMouseReleased(e);
120 121
        }
121 122
    }
......
127 128
        getMapControl().drawMap(true);
128 129

  
129 130
        m_FirstPoint = null;
130
        isMyButton = false;
131 131
    }
132 132

  
133 133

  
134 134

  
135 135
    @Override
136 136
    public void mouseDragged(MouseEvent e) {
137
        if (isMyButton) {
137
        if (this.isMyButton(e)) {
138 138
            m_LastPoint = e.getPoint();
139 139
            getMapControl().repaint();
140 140
        }
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/tools/Behavior/Behavior.java
80 80

  
81 81
	protected GeometryManager geomManager = GeometryLocator.getGeometryManager();
82 82
	
83
        protected int mouseButton = BUTTON_LEFT;
83
        private int mouseButton = BUTTON_LEFT;
84
        private boolean isMyButton = false; 
84 85
        
85 86
        public Behavior() {
86 87
            
......
266 267
	 * Create an arc. If there is an
267 268
	 * error return <code>null</code> and add the error
268 269
	 * to the log
269
	 * @param centerX
270
	 * @param centerY
271
	 * @param angleStart
272
	 * @param angleExtent
273
	 * @return
274
	 * The arc
270
        * @param centerX
271
        * @param centerY
272
        * @param radious
273
        * @param angleStart
274
        * @param angleExtent
275
        * @return The arc
275 276
	 */
276 277
	protected Arc createArc(double centerX, double centerY, double radious,
277 278
			double angleStart, double angleExtent){
......
298 299
	 * to the log
299 300
	 * @param centerX
300 301
	 * @param centerY
302
     * @param radious
301 303
	 * @return
302 304
	 * The arc
303 305
	 */
......
339 341
	}
340 342
        
341 343
        
342
        protected boolean isMyButton(MouseEvent e) {
344
        public boolean isMyButton(MouseEvent e) {
345
            if( e == null ) {
346
                return this.isMyButton;
347
            }
343 348
            switch(this.mouseButton) {
344 349
                case BUTTON_LEFT:
345 350
                default:
346
                    return (SwingUtilities.isLeftMouseButton(e));
351
                    this.isMyButton = SwingUtilities.isLeftMouseButton(e);
352
                    return this.isMyButton ;
347 353
                case BUTTON_MIDDLE:
348
                    return (SwingUtilities.isMiddleMouseButton(e));
354
                    this.isMyButton = SwingUtilities.isMiddleMouseButton(e);
355
                    return this.isMyButton ;
349 356
                case BUTTON_RIGHT:
350
                    return (SwingUtilities.isRightMouseButton(e));                   
357
                    this.isMyButton = SwingUtilities.isRightMouseButton(e);
358
                    return this.isMyButton ;
351 359
            }
352 360
        }
361
        
362
        public boolean isMyButton() {
363
            return this.isMyButton;
364
        }
353 365
}

Also available in: Unified diff