Ignore:
Timestamp:
2016-01-03T15:03:35+01:00 (9 years ago)
Author:
holgermappt
Message:

Disable center view while a photo is moved, see #josm11908. Updates for javadoc and i18n.

Location:
applications/editors/josm/plugins/photoadjust/src/org/openstreetmap/josm/plugins/photoadjust
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/photoadjust/src/org/openstreetmap/josm/plugins/photoadjust/PhotoAdjustPlugin.java

    r30962 r31922  
    3636        super(info);
    3737        GeoImageLayer.registerMenuAddition(new UntaggedGeoImageLayerAction());
     38        //new PhotoPropertyEditor();
    3839        worker = new PhotoAdjustWorker();
    3940        initAdapters();
     
    5152                    layers.add(imageLayer);
    5253                    worker.doMousePressed(evt, layers);
     54                }
     55            }
     56
     57            @Override
     58            public void mouseReleased(MouseEvent evt) {
     59                if (imageLayer != null) {
     60                    worker.doMouseReleased(evt);
    5361                }
    5462            }
  • applications/editors/josm/plugins/photoadjust/src/org/openstreetmap/josm/plugins/photoadjust/PhotoAdjustWorker.java

    r31413 r31922  
    2323    // the photo is moved very far.
    2424    private Point2D dragOffset = null;
     25    private boolean centerViewIsDisabled = false;
     26    private boolean centerViewNeedsEnable = false;
    2527
    2628    /**
     
    3133        dragLayer = null;
    3234        dragOffset = null;
     35    }
     36
     37    /**
     38     * Disable the "center view" button.  The map is moved instead of the
     39     * photo if the center view is enabled while a photo is moved.  The method
     40     * disables the center view to avoid such behavior.  Call
     41     * restoreCenterView() to restore the original state.
     42     */
     43    public void disableCenterView() {
     44        if (!centerViewIsDisabled) {
     45            centerViewIsDisabled = true;
     46            centerViewNeedsEnable = ImageViewerDialog.setCentreEnabled(false);
     47        }
     48    }
     49
     50    /**
     51     * Restore the center view state that was active before
     52     * disableCenterView() was called.
     53     */
     54    public void restoreCenterView() {
     55        if (centerViewIsDisabled) {
     56            if (centerViewNeedsEnable) {
     57                centerViewNeedsEnable = false;
     58                ImageViewerDialog.setCentreEnabled(true);
     59            }
     60            centerViewIsDisabled = false;
     61        }
    3362    }
    3463
     
    94123                            dragLayer = layer;
    95124                            setDragOffset(dragPhoto, evt);
     125                            disableCenterView();
    96126                            break;
    97127                        }
     
    100130            }
    101131        }
     132    }
     133
     134    /**
     135     * Mouse release handler.
     136     *
     137     * @param evt Mouse event from MouseAdapter mouseReleased().
     138     */
     139    public void doMouseReleased(MouseEvent evt) {
     140        restoreCenterView();
    102141    }
    103142
     
    114153            }
    115154            else {
     155                disableCenterView();
    116156                movePhoto(dragPhoto, dragLayer, evt);
    117157            }
Note: See TracChangeset for help on using the changeset viewer.