Changeset 15481 in josm


Ignore:
Timestamp:
2019-10-29T14:44:30+01:00 (6 weeks ago)
Author:
stoecker
Message:

prevent overlong scroll sessions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r15041 r15481  
    739739     */
    740740    public void smoothScrollTo(EastNorth newCenter) {
    741         // FIXME make these configurable.
    742         final int fps = 20;     // animation frames per second
    743         final int speed = 1500; // milliseconds for full-screen-width pan
    744741        final EastNorth oldCenter = getCenter();
    745742        if (!newCenter.equals(oldCenter)) {
     743            final int fps = Config.getPref().getInt("smooth.scroll.fps", 20);     // animation frames per second
     744            final int speed = Config.getPref().getInt("smooth.scroll.speed", 1500); // milliseconds for full-screen-width pan
     745            final int maxtime = Config.getPref().getInt("smooth.scroll.maxtime", 5000); // milliseconds maximum scroll time
    746746            final double distance = newCenter.distance(oldCenter) / getScale();
    747747            final double milliseconds = distance / getWidth() * speed;
     748            if (milliseconds > maxtime) { // prevent overlong scroll time, speed up if necessary
     749                milliseconds = maxtime;
     750            }
    748751            final double frames = milliseconds * fps / 1000;
    749752            final EastNorth finalNewCenter = newCenter;
     
    753756                public void run() {
    754757                    for (int i = 0; i < frames; i++) {
    755                         // FIXME - not use zoom history here
     758                        // FIXME - do not use zoom history here
    756759                        zoomTo(oldCenter.interpolate(finalNewCenter, (i+1) / frames));
    757760                        try {
Note: See TracChangeset for help on using the changeset viewer.