Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14740 closed defect (fixed)

Current displayed data position changes when you press TAB

Reported by: IlBano Owned by: team
Priority: normal Milestone: 17.05
Component: Core Version: latest
Keywords: template_report position tab regression Cc: bastiK, michael2402

Description

What steps will reproduce the problem?

  1. load an arbitrary amount of data from OSM
  2. press TAB to hide/show the toolbox

What is the expected result?

The current displayed data should remain in the same position as it was before hiding/showing toolbox

What happens instead?

The position of data on screen moves some pixel to the right every time the toolbox is set to hide with TAB key

Please provide any additional information below. Attach a screenshot if possible.

The previous stable release of JOSM was not affected

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2017-05-02 23:28:33 +0200 (Tue, 02 May 2017)
Build-Date:2017-05-02 21:34:40
Revision:12039
Relative:URL: ^/trunk

Identification: JOSM/1.5 (12039 en) Windows 7 32-Bit
Memory Usage: 236 MB / 247 MB (110 MB allocated, but free)
Java version: 1.8.0_101-b13, Oracle Corporation, Java HotSpot(TM) Client VM
Screen: \Display0 1600x900
Maximum Screen Size: 1600x900
VM arguments: [-Djava.security.manager, -Djava.security.policy=file:<java.home>\lib\security\javaws.policy, -DtrustProxy=true, -Djnlpx.home=<java.home>\bin, -Djnlpx.origFilenameArg=%UserProfile%\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\56\1ee8cfb8-2681b3e8, -Djnlpx.remove=false, -Djava.util.Arrays.useLegacyMergeSort=true, -Djnlpx.splashport=58723, -Djnlp.application.href=https://josm.openstreetmap.de/download/josm.jnlp, -Djnlpx.jvm=<java.home>\bin\javaw.exe]
Dataset consistency test: No problems found

Plugins:
+ apache-commons (32994)
+ buildings_tools (33004)
+ ejml (32680)
+ geotools (33042)
+ jts (32699)
+ opendata (33245)
+ utilsplugin2 (33212)

Tagging presets:
+ D:\Dati\Josm\myJosmPresets.xml

Last errors/warnings:
- W:  Culvert: Could not get presets icon presets/tunnel.png
- E: Failed to locate image 'presets/bridge.png'
- W:  Bridge: Could not get presets icon presets/bridge.png
- E: Failed to locate image 'presets/river.png'
- W:  Ditch: Could not get presets icon presets/river.png
- E: Failed to locate image 'presets/parking.png'
- W:  Parking: Could not get presets icon presets/parking.png
- E: Failed to locate image 'presets/way_unclassified.png'
- W:  Service Hwy: Could not get presets icon presets/way_unclassified.png

Attachments (0)

Change History (18)

comment:1 by michael2402, 7 years ago

Cc: bastiK michael2402 added
Milestone: 17.05
Version: latest

comment:2 by michael2402, 7 years ago

Component: CoreCore mappaint

comment:3 by Klumbumbus, 7 years ago

Keywords: regression added

comment:4 by bastiK, 7 years ago

Klumbumbus, regression from what version?

comment:5 by Klumbumbus, 7 years ago

I don't know, I didn't check. I just added the keyword, as IlBano said "The previous stable release of JOSM was not affected"

comment:6 by bastiK, 7 years ago

Okay, right.

comment:7 by Klumbumbus, 7 years ago

I made a quick check with versions from https://josm.openstreetmap.de/download/. Should be somewehere between 11839 and 11845

comment:8 by bastiK, 7 years ago

proposed fix:

  • src/org/openstreetmap/josm/gui/MapViewState.java

     
    230230    }
    231231
    232232    /**
    233      * Gets the center of the view, rounded to a pixel coordinate
    234      * @return The center position.
    235      * @since 10856
    236      */
    237     public MapViewPoint getCenterAtPixel() {
    238         return getForView(viewWidth / 2, viewHeight / 2);
    239     }
    240 
    241     /**
    242233     * Gets the width of the view on the Screen;
    243234     * @return The width of the view component in screen pixel.
    244235     */
  • src/org/openstreetmap/josm/gui/NavigatableComponent.java

     
    301301     * Zoom in current view. Use configured zoom step and scaling settings.
    302302     */
    303303    public void zoomIn() {
    304         zoomTo(state.getCenterAtPixel().getEastNorth(), scaleZoomIn());
     304        zoomTo(state.getCenter().getEastNorth(), scaleZoomIn());
    305305    }
    306306
    307307    /**
     
    308308     * Zoom out current view. Use configured zoom step and scaling settings.
    309309     */
    310310    public void zoomOut() {
    311         zoomTo(state.getCenterAtPixel().getEastNorth(), scaleZoomOut());
     311        zoomTo(state.getCenter().getEastNorth(), scaleZoomOut());
    312312    }
    313313
    314314    protected void updateLocationState() {
     
    405405     * @return the current center of the viewport
    406406     */
    407407    public EastNorth getCenter() {
    408         return state.getCenterAtPixel().getEastNorth();
     408        return state.getCenter().getEastNorth();
    409409    }
    410410
    411411    /**

in reply to:  8 ; comment:9 by Don-vip, 7 years ago

Replying to bastiK:

proposed fix:

looks good, is there a reason not to commit it?

comment:10 by Don-vip, 7 years ago

Component: Core mappaintCore

comment:11 by michael2402, 7 years ago

It should be fine.

This was used to align the view to pixels. Now that we have other code for that it should be OK.

Have you tested zooming in and out a lot? There might be situations where the pixel rounding will introduce a offset so that you move the map by zooming. It did not happen in my current tests, but might be related to map view size/...

comment:12 by bastiK, 7 years ago

Resolution: fixed
Status: newclosed

In 12074/josm:

fixed #14740 - Current displayed data position changes when you press TAB

in reply to:  9 comment:13 by bastiK, 7 years ago

Replying to Don-vip:

Replying to bastiK:

proposed fix:

looks good, is there a reason not to commit it?

I wasn't sure what getCenterAtPixel was intended for.

in reply to:  11 comment:14 by bastiK, 7 years ago

Replying to michael2402:

It should be fine.

This was used to align the view to pixels. Now that we have other code for that it should be OK.

Thanks!

Have you tested zooming in and out a lot? There might be situations where the pixel rounding will introduce a offset so that you move the map by zooming. It did not happen in my current tests, but might be related to map view size/...

Seems to be okay, but this can be very subtle, so we'll see.

comment:15 by bastiK, 7 years ago

In 12076/josm:

see #14740 - update test

comment:16 by IlBano, 7 years ago

I just found out that the same problem happens also when you move around using CTRL+<arrow key>... just to gives further details since I'm not able to understand if the proposed patch fixes also this.

comment:17 by bastiK, 7 years ago

The proposed patch has already been applied, please download version 12074 or later and test yourself!

in reply to:  17 comment:18 by anonymous, 7 years ago

Replying to bastiK:

The proposed patch has already been applied, please download version 12074 or later and test yourself!

Works with 12081. Thanks

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.