problem with text element

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with text element

bader houmad

Hello,

My problem is when I create a text element in my canvas, and when pointing on it the cursor becames of text type, and i can select the text, i don't want this functionnality, is there a way to remove the listener that does that?

I ceate the text element this way:

Element text = myDoc.createElementNS(myDoc.getDocumentElement.NamespaceURI(),"text");

Text value= myDoc.createTextNode("toto");

text.appendChild(value);

text.setAttributeNS(....);

myDoc.getDocumentElement().appendChild(text);

myCanvas.setSVGDocument(SVGDocument(myDoc));

 

THANKS IN ADVANCE



MSN Hotmail : choisissez votre adresse @hotmail.fr --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

preserveAspectRatio, 'stretching' an image not working by percentage, and batik

Arian Hojat
Hello all,
I view an svg in adobe svg viewer and it stretches the width and
height to be 100% of the svg document. but batik does not correctly
render it when i transcode (it will stretch the height so it fills up
the svg document. But it wont 'stretch' the width to match the svg doc
as well.)... Could it be adobe svg viewer is just leniant? or Batik is
not leniant with my code.

Anyone got ideas. I dont really override aspect ratio settings since
svg viewer interprets it fine.

Here are my svg code batik makes and images if anyone is more interested.

<svg contentScriptType="text/ecmascript" width="720"
xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify"
contentStyleType="text/css" height="360"
preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"
version="1.0">

<image x="0" y="0" width="720"
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="8.jpg"
xlink:type="simple" xlink:actuate="onLoad" height="360"
preserveAspectRatio="xMidYMid meet" xlink:show="embed"/>

<image x="0" y="0" width="100%"
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="4.png"
xlink:type="simple" xlink:actuate="onLoad" opacity="0.7" height="100%"
preserveAspectRatio="xMidYMid meet" xlink:show="embed"/>

</svg>


http://www.pages.drexel.edu/~ah49/images/8.jpg
http://www.pages.drexel.edu/~ah49/images/4.png

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: preserveAspectRatio, 'stretching' an image not working by percentage, and batik

thomas.deweese
Arian Hojat wrote:

> I view an svg in adobe svg viewer and it stretches the width and
> height to be 100% of the svg document. but batik does not correctly
> render it when i transcode (it will stretch the height so it fills up
> the svg document. But it wont 'stretch' the width to match the svg doc
> as well.)... Could it be adobe svg viewer is just leniant? or Batik is
> not leniant with my code.

    The mentioned behavior is a flat out bug in ASV.  They ignore
the value of preserveAspectRatio and always behave as if it were
'none'.  The behavior you describe is the correct behavior for
the value you have provided 'xMidyMid meet'.

> Anyone got ideas. I dont really override aspect ratio settings since
> svg viewer interprets it fine.

   No the 'svg viewer' interprets it wrong.  Give it the proper value
'none' and your document will render as you want in Batik, and any
other con formant SVG viewer/renderer you pass it to.

> Here are my svg code batik makes and images if anyone is more interested.
>
> <svg contentScriptType="text/ecmascript" width="720"
> xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify"
> contentStyleType="text/css" height="360"
> preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"
> version="1.0">
>
> <image x="0" y="0" width="720"
> xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="8.jpg"
> xlink:type="simple" xlink:actuate="onLoad" height="360"
> preserveAspectRatio="xMidYMid meet" xlink:show="embed"/>
>
> <image x="0" y="0" width="100%"
> xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="4.png"
> xlink:type="simple" xlink:actuate="onLoad" opacity="0.7" height="100%"
> preserveAspectRatio="xMidYMid meet" xlink:show="embed"/>
>
> </svg>
>
>
> http://www.pages.drexel.edu/~ah49/images/8.jpg
> http://www.pages.drexel.edu/~ah49/images/4.png
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: problem with text element

thomas.deweese
In reply to this post by bader houmad
Hi Bader,

    The simplest solution to this is to use 'pointer-events="none"' on
the text element (or some parent of the text element).  This does have
a potentially bad side effect of making the text unclickable (which
can be 'fixed' by placing a proxy unfilled rect or something under
the text).

bader houmad wrote:

> Hello,
>
> My problem is when I create a text element in my canvas, and when
> pointing on it the cursor becames of text type, and i can select the
> text, i don't want this functionnality, is there a way to remove the
> listener that does that?
>
> I ceate the text element this way:
>
> Element text =
> myDoc.createElementNS(myDoc.getDocumentElement.NamespaceURI(),"text");
>
> Text value= myDoc.createTextNode("toto");
>
> text.appendChild(value);
>
> text.setAttributeNS(....);
>
> myDoc.getDocumentElement().appendChild(text);
>
> myCanvas.setSVGDocument(SVGDocument(myDoc));
>
>  
>
> THANKS IN ADVANCE
>
>
> MSN Hotmail : choisissez votre adresse @hotmail.fr
> <http://g.msn.com/8HMBFRFR/2752??PS=47575>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: [hidden email] For
> additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]