Modify

Opened 4 years ago

Closed 4 years ago

#7183 closed defect (fixed)

A scroll-bars are always appear around image

Reported by: g1itch Owned by: richard
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 4 years ago by g1itch

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 follow-up: Changed 4 years ago by richard

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 4 years ago by g1itch

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 4 years ago by richard

  • Resolution set to fixed
  • Status changed from new to closed

fixed in [8063]

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.