Changeset 10856 in josm for trunk/src/org


Ignore:
Timestamp:
2016-08-19T22:47:37+02:00 (4 years ago)
Author:
Don-vip
Message:

fix #13375 - Fix icon rendering (patch by michael2402) - gsoc-core + add unit test

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r10842 r10856  
    703703        g.setFont(text.font);
    704704
    705         int x = (int) (p.getInViewX() + text.xOffset);
    706         int y = (int) (p.getInViewY() + text.yOffset);
     705        int x = (int) (Math.round(p.getInViewX()) + text.xOffset);
     706        int y = (int) (Math.round(p.getInViewY()) + text.yOffset);
    707707        /**
    708708         *
     
    890890        }
    891891
    892         double x = p.getInViewX();
    893         double y = p.getInViewY();
     892        double x = Math.round(p.getInViewX());
     893        double y = Math.round(p.getInViewY());
    894894        temporaryGraphics.translate(x, y);
    895895        temporaryGraphics.rotate(theta);
  • trunk/src/org/openstreetmap/josm/gui/MapViewState.java

    r10829 r10856  
    216216    public MapViewPoint getCenter() {
    217217        return getForView(viewWidth / 2.0, viewHeight / 2.0);
     218    }
     219
     220    /**
     221     * Gets the center of the view, rounded to a pixel coordinate
     222     * @return The center position.
     223     * @since 10856
     224     */
     225    public MapViewPoint getCenterAtPixel() {
     226        return getForView(viewWidth / 2, viewHeight / 2);
    218227    }
    219228
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r10843 r10856  
    294294     */
    295295    public void zoomIn() {
    296         zoomTo(getCenter(), scaleZoomIn());
     296        zoomTo(state.getCenterAtPixel().getEastNorth(), scaleZoomIn());
    297297    }
    298298
     
    301301     */
    302302    public void zoomOut() {
    303         zoomTo(getCenter(), scaleZoomOut());
     303        zoomTo(state.getCenterAtPixel().getEastNorth(), scaleZoomOut());
    304304    }
    305305
     
    408408     */
    409409    public EastNorth getCenter() {
    410         return state.getCenter().getEastNorth();
     410        return state.getCenterAtPixel().getEastNorth();
    411411    }
    412412
     
    608608        if (!newCenter.equals(getCenter())) {
    609609            EastNorth oldCenter = getCenter();
    610             state = state.usingCenter(newCenter);
     610            state = state.movedTo(state.getCenterAtPixel(), newCenter);
    611611            if (!initial) {
    612612                firePropertyChange(PROPNAME_CENTER, oldCenter, newCenter);
     
    617617            state = state.usingScale(newScale);
    618618            // temporary. Zoom logic needs to be moved.
    619             state = state.movedTo(state.getCenter(), newCenter);
     619            state = state.movedTo(state.getCenterAtPixel(), newCenter);
    620620            if (!initial) {
    621621                firePropertyChange(PROPNAME_SCALE, oldScale, newScale);
Note: See TracChangeset for help on using the changeset viewer.