Hi Sascha,
"Sascha L. Teichmann" <[EMAIL PROTECTED]> wrote on 12/11/2006
06:16:21 PM:
> It's a bit inconvenient because I use the inner svg as a container
> for other SVG documents being loaded after user interactions.
> The consequence is that I have to alter their svg width height
> attributes as well.
I don't follow what is inconvenient? The use of viewBox?
Or dropping the use of 'real world' coordinates?
> The real world coordinates were chosen because the application
> is a used as layout component for printing.
This is a common misunderstanding, the only place where
real world units have any connection with the real world is
the 'width' and 'height' on the outermost SVG elements.
In all other locations the real world units are mapped to
user units (unitless numbers in the local coordinate system):
<rect x="10mm" y="10mm" width="50mm" height="25mm" fill="blue"/>
<rect transform="scale(3)"
x="10mm" y="10mm" width="50mm" height="25mm" fill="red"/>
The Red rectangle will be 3x the size of the blue rectangle.
The worst part of this is that the mapping from real world units
to user units is based on an arbitrary mapping of real world units
to 'px'. Most SVG user agents choose 96 px per inch, but this is
not required by the spec, so an SVG User agent could use 72 or 300
for examples of other common values. At which point your real
world units could be ~25% smaller or ~300% larger!
http://www.w3.org/TR/SVG11/coords.html#Units
It is much more sane to establish a mapping between user
units and real world units on the root SVG Element and then
drop the use of real world units everywhere else in the document.
This is what my example did:
<svg width="230mm" height="317mm" // request a real world size!
viewBox="0 0 230 317" // Say that 0,0 -> 230,317 maps to
that.
version="1.1" xmlns="http://www.w3.org/2000/svg">
This establishes one user unit (a unitless value) as
being == one millimeter. It also lets the JSVGScrollPane
know what part of the canvas it should scroll over...
> thomas.deweese wrote:
> >
> > Hi Sascha,
> >
> > "Sascha L. Teichmann" <[EMAIL PROTECTED]> wrote on 12/11/2006
> > 08:39:59 AM:
> >
> >> I want to to simulate a virtual paper sheet as drawing background by
> > loading
> >> following SVG at program startup to my JSVGCanvas. The JSVGCanvas
> >> is embedded in a JSVGScrollPane. The JSVGScrollPane is in JPane which
> >> is in a JFrame. Everything is right till I'm going to resize the
JFrame
> > and
> >> scroll around with scrollbars of the JSVGScrollPane ... The inner svg
> >> suddenly sticks to to upper left corner and the intended inset
vanishes.
> >
> > I would strongly suggest that you use viewBox to establish the
> > interior coordinate system and then abandon the use of real world
> > units (like 'mm') in all but the outermost SVG elements width and
> > height:
> >
> > <svg width="230mm" height="317mm"
> > viewBox="0 0 230 317"
> > version="1.1" xmlns="http://www.w3.org/2000/svg">
> > <svg width="210" height="297" x="10" y="10"
> > id="viewer-layout-sheet-svg"
> > overflow="visible">
> > <rect x="0" y="0" width="210" height="297"
> > style="fill:white"
> > id="viewer-layout-sheet-svg"/>
> > </svg>
> > </svg>
> >
> >
> >> <svg width="230mm" height="317mm" version="1.1"
> >> xmlns="http://www.w3.org/2000/svg">
> >> <svg width="210mm" height="297mm" x="10mm" y="10mm"
> >> id="viewer-layout-sheet-svg"
> >> overflow="visible">
> >> <rect x="0" y="0" width="210mm" height="297mm"
> >> style="fill:white"
> >> id="viewer-layout-sheet-svg"/>
> >> </svg>
> >> </svg>
> >>
> >> At
> >>
> >> --
> >> View this message in context: http://www.nabble.com/Nested-svgs-and-
> >> JSVGScrollPane-tf2794054.html#a7794851
> >> Sent from the Batik - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> >> For additional commands, e-mail:
[EMAIL PROTECTED]
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Nested-svgs-and-
> JSVGScrollPane-tf2794054.html#a7824089
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>