Opened 10 years ago

Last modified 7 years ago

#11262 closed defect

Image not displayed correctly in Help Window -> Map View — at Version 4

Reported by: raykiddy Owned by: team
Priority: normal Milestone: 15.10
Component: Core Version:
Keywords: help svg html Cc:

Description (last modified by Don-vip)

The image at the start of this Help information is not being displayed correctly. Either the image is bad, or it is being set to the wrong height.


Change History (5)

by raykiddy, 10 years ago

Attachment: JOSM_Help_View.png added

comment:1 by Klumbumbus, 10 years ago

There are also some problems on the help start page (Help) in the JOSM Help Browser

  • icons with wrong aspect ratio (same problem like OP)
  • svg do not work at all

comment:2 by Don-vip, 10 years ago

Component: unspecifiedCore

comment:3 by simon04, 9 years ago

Milestone: 15.10

For displaying SVG, this might be the way to go: http://stackoverflow.com/a/16073804, override javax.swing.text.html.HTMLEditorKit.HTMLFactory#create for kind==HTML.Tag.IMG.

For the correct height, the simplest version would be to drop the width information thus showing the image in full width+height (see below). We also might implement a better computation when considering SVG images.

  • src/org/openstreetmap/josm/tools/WikiReader.java

    diff --git a/src/org/openstreetmap/josm/tools/WikiReader.java b/src/org/openstreetmap/josm/tools/WikiReader.java
    index 6094c40..1246efa 100644
    a b protected String readFromTrac(BufferedReader in, URL url) throws IOException {  
    142142                // add a border="0" attribute to images, otherwise the internal help browser
    143143                // will render a thick  border around images inside an <a> element
    144144                b += line.replaceAll("<img ", "<img border=\"0\" ")
     145                         .replaceAll("width=\"(\\d+)\"", "")
    145146                         .replaceAll("<span class=\"icon\">.</span>", "")
    146147                         .replaceAll("href=\"/", "href=\"" + baseurl + "/")
    147148                         .replaceAll(" />", ">")

comment:4 by Don-vip, 9 years ago

Description: modified (diff)
Keywords: help svg html added; Help Window removed
Note: See TracTickets for help on using tickets.