rebootcode / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

Opening files off Webserver by using URL does not retain original canvas attributes #876

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. opening source files from URL width and height attributes remain at default 
regardless of source file <svg width="640" height="480" 
xmlns="http://www.w3.org/2000/svg">

What is the expected output? What do you see instead?
<svg width="2048" height="2048" xmlns="http://www.w3.org/2000/svg">

In what browser did you experience this problem? (ALL, Firefox, Opera, etc) 
Chrome 15.0.874.106m

In what version of SVG-edit does the problem occur? (Latest trunk, 2.5.1,
etc) 2.5.1

Please provide any additional information below.

Source file can be found here:
http://sentilnal.dyndns.org:81/sentilnal/modules/image_repo/

http://sentilnal.dyndns.org:81/sentilnal/modules/image_repo/Global%20Design@Cont
inents!1.svg

When using a link to open the file:

http://sentilnal.dyndns.org:81/Sentilnal/modules/canvas/Paint.html?url=../image_
repo/Global%20Design@Continents!1.svg

the original canvas size is set to default, expanding this manually does not 
affect the saved data, however it is unusual.

To simplify saving to a server I've been working with php and fopen to write to 
the server, and looking at the app the easiest way to open the file is via URL.

Any suggestions \ comments \ concerns please let me know.

Original issue reported on code.google.com by tyrell.hills on 2 Nov 2011 at 5:15

GoogleCodeExporter commented 9 years ago
had the same issue, and added the code to the for loop in the function 
elementChanged in svg-editor.js around line 610.
var elem = elems[i];

// if the element changed was the svg, then it could be a resolution change
if (elem && elem.tagName == "svg") {
    populateLayers();
    var origH, origW;
    origH = elem.getAttribute("height");
    origW = elem.getAttribute("width");
    updateCanvas();
    svgCanvas.setResolution(origW, origH)
} 
the updateCanvas function was setting the H&W to the defaults. I couldn't 
figure out a good was to alter the updateCanvas function, so I did it there.

Original comment by eric.mik...@gmail.com on 6 Jan 2012 at 9:59