Changeset 13201 in josm
- Timestamp:
- 2017-12-16T18:37:30+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapSlider.java
r12537 r13201 5 5 6 6 import java.awt.Dimension; 7 import java.beans.PropertyChangeEvent;8 import java.beans.PropertyChangeListener;9 7 10 8 import javax.swing.JSlider; … … 14 12 15 13 import org.openstreetmap.josm.gui.help.Helpful; 14 import org.openstreetmap.josm.gui.NavigatableComponent.ZoomChangeListener; 16 15 17 16 /** 18 17 * This is the slider used in the top left corner of the map view. It allows the user to select the scale 19 18 */ 20 class MapSlider extends JSlider implements PropertyChangeListener, ChangeListener, Helpful {19 class MapSlider extends JSlider implements ZoomChangeListener, ChangeListener, Helpful { 21 20 22 21 private static final double ZOOM_STEP = 1.1; … … 29 28 setOpaque(false); 30 29 this.mv = mv; 31 mv.addPropertyChangeListener("scale",this);30 NavigatableComponent.addZoomChangeListener(this); 32 31 addChangeListener(this); 33 32 // Call this manually once so it gets setup correctly 34 propertyChange(null);33 zoomChanged(); 35 34 int w = UIManager.getDefaults().getInt("Slider.thumbWidth") + 150; 36 35 setPreferredSize(new Dimension(w, 27)); … … 38 37 39 38 @Override 40 public void propertyChange(PropertyChangeEvent evt) {39 public void zoomChanged() { 41 40 double maxScale = this.mv.getMaxScale(); 42 41 int zoom = (int) Math.round(Math.log(maxScale/mv.getScale())/Math.log(ZOOM_STEP)); … … 63 62 mv.zoomTo(this.mv.getCenter(), snapped); 64 63 } 65 propertyChange(null);64 zoomChanged(); 66 65 } 67 66
Note:
See TracChangeset
for help on using the changeset viewer.