You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "Barbisch, Martin" <ba...@sony.de> on 2002/06/20 16:09:05 UTC
Problems changing the transform attribute.
Hello there!
I wrote the following SVG file and displayed it with Batik and Adobe's SVG
Viewer.
When the transform attribute of <use> is changed (onclick()) Batik
translates the upper left corner of the referenced <symbol> to the window
origin. ASV does not. Which is the correct behavior? Simply changing the
transform attribute of a <rect> works as expected.
Thanks,
Martin
ProblemTransform.svg:
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="350" height="200">
<script type="text/ecmascript"> <![CDATA[
function scale(evt) {
var box = evt.getCurrentTarget();
var tf = box.getAttribute("transform");
if (tf == "scale(1.0)") box.setAttribute("transform", "scale(1.2)");
else box.setAttribute("transform", "scale(1.0)");
}
]]> </script>
<defs>
<symbol id="Rect" preserveAspectRatio="none" viewBox="0 0 100 100">
<rect x="0" y="0" width="100" height="100"
style="stroke:yellow; fill:red" />
</symbol>
</defs>
<use xlink:href="#Rect" x="20" y="40" width="100" height="80"
transform="scale(1.0)" onclick="scale(evt)" />
<rect x="150" y="40" width="100" height="80" transform="scale(1.0)"
style="fill:green; stroke:yellow" onclick="scale(evt)" />
<text x="175" y="190" style="font-size:20pt; text-anchor:middle">
Transform problem.
</text>
</svg>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Problem of inserting new node into the DOM
Posted by Danh Hoai <ho...@indent.org>.
Hi everyone,
I am trying to read an element from the database and then insert it into the
DOM, but batik generates errors as below:
Exception occurred during event dispatching:
org.w3c.dom.DOMException: The given node (type: 1, name: g) was not created
by the current document.
at org.apache.batik.dom.AbstractNode.createDOMException(Unknown Source)
at org.apache.batik.dom.AbstractParentNode.checkAndRemove(Unknown Source)
at org.apache.batik.dom.AbstractParentNode.appendChild(Unknown Source)
I write a program that saves serialized objects into the database and then
it extracts elements in the Objects into the DOM.
Anyone knows how to solve the above errors, please help.
Danh
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Problems changing the transform attribute.
Posted by Vincent Hardy <vi...@sun.com>.
Martin,
I have entered a bug in Bugzilla with a modified version of your example
that shows that if we remove the scaled node, modify its attribute and
then insert it again (which should have the exact same result), we get
the behavior you expect.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10066
Thanks for reporting this,
Vincent.
"Barbisch, Martin" wrote:
>
> Hello there!
>
> I wrote the following SVG file and displayed it with Batik and Adobe's SVG
> Viewer.
> When the transform attribute of <use> is changed (onclick()) Batik
> translates the upper left corner of the referenced <symbol> to the window
> origin. ASV does not. Which is the correct behavior? Simply changing the
> transform attribute of a <rect> works as expected.
>
> Thanks,
> Martin
>
> ProblemTransform.svg:
>
> <?xml version="1.0"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
>
> <svg width="350" height="200">
>
> <script type="text/ecmascript"> <![CDATA[
>
> function scale(evt) {
>
> var box = evt.getCurrentTarget();
> var tf = box.getAttribute("transform");
>
> if (tf == "scale(1.0)") box.setAttribute("transform", "scale(1.2)");
> else box.setAttribute("transform", "scale(1.0)");
> }
>
> ]]> </script>
>
> <defs>
> <symbol id="Rect" preserveAspectRatio="none" viewBox="0 0 100 100">
> <rect x="0" y="0" width="100" height="100"
> style="stroke:yellow; fill:red" />
> </symbol>
> </defs>
>
> <use xlink:href="#Rect" x="20" y="40" width="100" height="80"
> transform="scale(1.0)" onclick="scale(evt)" />
>
> <rect x="150" y="40" width="100" height="80" transform="scale(1.0)"
> style="fill:green; stroke:yellow" onclick="scale(evt)" />
>
> <text x="175" y="190" style="font-size:20pt; text-anchor:middle">
> Transform problem.
> </text>
>
> </svg>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Problems changing the transform attribute.
Posted by Vincent Hardy <vi...@sun.com>.
Martin,
I just committed a fix for this.
Thanks,
Vincent.
"Barbisch, Martin" wrote:
>
> Hello there!
>
> I wrote the following SVG file and displayed it with Batik and Adobe's SVG
> Viewer.
> When the transform attribute of <use> is changed (onclick()) Batik
> translates the upper left corner of the referenced <symbol> to the window
> origin. ASV does not. Which is the correct behavior? Simply changing the
> transform attribute of a <rect> works as expected.
>
> Thanks,
> Martin
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org