Modify

Opened 8 years ago

Closed 8 years ago

#7183 closed defect (fixed)

A scroll-bars are always appear around image

Reported by: Dmitri Owned by: Richard Liao
Priority: normal Component: TracImageSvgMacro
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

In Firefox 3.5 and 3.6 I always see the scroll-bars around image, displayed by you plugin. It may be wrong, but I solved this problem by this modification:

  • imagesvg/web_ui.py

    old new  
    118118                    w_unit = "pt"
    119119                    h_unit = "pt"
    120120
     121        w_val += 1
     122        h_val += 1
    121123
    122124                dimensions = 'width="%(w_val)s%(w_unit)s" height="%(h_val)s%(h_unit)s"' % locals()
    123125            except:

I think 1 pt is not much, but it's enough to remove scroll-bars.

Attachments (0)

Change History (4)

comment:1 Changed 8 years ago by Dmitri

Unfortunately I cannot edit description, but more precisely patch might be

  • imagesvg/web_ui.py

    old new  
    118118                    w_unit = "pt"
    119119                    h_unit = "pt"
    120120
     121                if w_unit != '%':
     122                    w_val += 1
     123                    h_val += 1
    121124
    122125                dimensions = 'width="%(w_val)s%(w_unit)s" height="%(h_val)s%(h_unit)s"' % locals()
    123126            except:

in order to make possible scaling svg with viewBox set.

comment:2 Changed 8 years ago by Richard Liao

If width and height are defined in the svg image, browser will try to display in the defined size. If the embed element is smaller than the size, scroll bars will appear. You can specify bigger element size like this:

[[ImageSvg(example.svg, 800, 600)]]

comment:3 in reply to:  2 Changed 8 years ago by Dmitri

Replying to richard:

If the embed element is smaller than the size, scroll bars will appear.

You right. I looked more closely and see that scroll bars appear for attributes like

width="589.61224"
height="370.06125"

For integer values all correct. svg-files are made with inkscape. May be some rounding procedure should be applied to w_val, h_val?

comment:4 Changed 8 years ago by Richard Liao

Resolution: fixed
Status: newclosed

fixed in [8063]

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Richard Liao.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.