I mean the absolute top-left X, Y and bottom-right X, Y of the whole SVG
document
(including what is NOT visible on the screen).
Christian
Do you mean the top-left X, Y and bottom-right X, Y of SVG Document thats
visible on screen?
If yes all you need to do is read the viewBox values. Here is a little
javascript code that does this.
function whatever()
{
var svgdoc = document.rootElement.getOwnerDocument(); //reference
to entire document
var svgtag = svgdoc.getDocumentElement(); //reference to <svg
......> tag
var vBox = svgtag.getAttribute("viewBox"); //returns viewBox value
as string
var vBoxArray = vBox.split(/ /); //splits string into array
separated by space
var minX = parseInt(vBoxArray[0]);
var minY = parseInt(vBoxArray[1]);
var width = parseInt(vBoxArray[2]); //by adding width to minX you
can get maxX
var height = parseInt(vBoxArray[3]); //by adding hegith to minY you
can getmaxY
}
Hope this will help.
Irfan Ali
Software Developer
Universal Map, Inc.
www.universalmap.com
Ph: (517)655-1759
Hello,
I need to know the minimum and maximum coordinates of an SVG document or
in other words: what are the lowest and highest x and y values in a whole
document.
My only idea is to parse all the elements, get the coordinates and
calculate the
min and max values, but that seems very costly to me so how can I fetch
minX, minY,
maxX, maxY easier?
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]