mustang2247 / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

maintain aspect ratio when resizing (flash renderer) #451

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Copy attached helloworld.html to your svgweb folder and open it in a web 
browser with the svg.render.forceflash=true parameter, or go directly to: 
http://ftp.bigcat.unimaas.nl/shared_folder/thomas/svgweb/helloworld.html?
svg.render.forceflash=true
2. Note that the helloworld svg is correctly rendered. Click OK in the 
popup dialog to resize its parent div. Note that the svg will be squeezed.

What is the expected output?
After you click OK, the width of the parent div of the svg object is 
decreased. I would expect the SVG image to clip and the aspect ratio to 
stay the same.

What do you see instead?
The SVG image will be squeezed instead.

What version of the product are you using? On what operating system,
browser, and version of Flash?
Tested in Firefox 3.5.7 and Chromium 5.0.315.0 on Linux (Ubuntu 9.10, 64-
bit), with the flash version from the ubuntu repository.

Note that this is only happening when the flash renderer is enabled. With 
native renderer, I see the expected result in Firefox:
http://ftp.bigcat.unimaas.nl/shared_folder/thomas/svgweb/helloworld.html

Original issue reported on code.google.com by thomaskelder on 4 Feb 2010 at 2:07

Attachments:

GoogleCodeExporter commented 8 years ago
After studying the actionscript code, I see that resize events (both on the 
flash object and browser window) will lead to 
changing the svg.scale. After commenting out these lines (see attached patch), 
the behavior of the flash and native rendering 
(in FF and Chromium) are the same in the example.

This raises two questions for me:
1. Why is the scale modified upon resizing the object? Is this specified in the 
SVG somewhere?
2. How can I turn this off without modifying the flash code?

Turning off the scaling (or at least maintaining aspect ratio) is relevant to 
my project, where I'd like to display the svg with 
100% width/height relative to the parent div, where the scale should remain 
intact when resizing the parent div. Currently, I 
use a workaround where I set the svg object to a very large absolute size in 
pixels and set the overflow of the parent div to 
hidden. However, this gives me strange clipping artifacts in some cases, e.g.: 
http://137.120.14.24/wikipathways-
test/wpi/PathwayWidget.php?id=WP1021

Original comment by thomaskelder on 16 Mar 2010 at 1:04

Attachments:

GoogleCodeExporter commented 8 years ago
Some of this behavior was to deal with browser level zooming. Unfortunately, the
resizing code is very complex and I dread digging into it again. But, we need 
to make
sure this fundamental behavior is not wrong. Bumping priority to high.

Original comment by grick23@gmail.com on 29 May 2010 at 5:01

GoogleCodeExporter commented 8 years ago
If I had to choose between correct resize behaviour and browser-level zooming, 
I would choose resize. Maybe it should be a configuration parameter, just like 
"svg.render.forceflash", at least until both can be supported simultaneously. 
In my web-app the svgweb box is bound to the size of the browser window 
(width:50%;height:50%) and this breaks all of the SVG inside it when in Flash 
mode.

Original comment by Yegor.Jb...@gmail.com on 6 Jan 2011 at 7:36