My first thought was to create some sort of class or even a range of
object id's that would allow all the things you want not to scale to be
identified, and then to set the scale, on those, independently from the
scale of everything else, through script. 

 

Then I thought that I had seen a "noscale" attribute value somewhere in
the SVG spec. A little bit of poking around revealed that with vector
effects in SVG1.2 there is a 'non-scaling-stroke' associated with vector
effects (see http://www.w3.org/TR/SVGMobile12/attributeTable.html). I
thought there was another way and suspect there still may be. Seems like
your situation is common enough that one might want a fairly ubiquitous
attribute called @scale - scale="normal" (the default) and scale="none"
when things like text and boundaries should not scale. One can imagine
that authors might have (for whatever reason) other objects (like
distant mountains that we might like to stay in the background). Maybe
@scale should have a number scale="1" means it scales normally like all
content, scale="0" means it is unaffected by zooming, anything in
between (scale =.25) would be a multiplier. That would give declarative
access to what we might call "sleeping beauty" space* (or "Scooby doo"
space)- like in  http://srufaculty.sru.edu/david.dailey/svg/balloon.svg
where different layers have different virtual viewports.

 

I still think we may be overlooking something that's already there in
SVG 1.1.

 

David

*In recognition of Disney's quite elegant usage of 2+epsilon-dimensional
space or of Scooby Doo's quite inelegant usage of it.

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of gfc22
Sent: Wednesday, September 10, 2008 12:28 PM
To: [email protected]
Subject: [svg-developers] Re: Non-scalable text labels in scalable
graphics?

 

Thanks Peter, 

That looks good for what I asked for. But unfortunately I also want some
lines to remain the same 
width under scaling.

So I've gone ahead and excluded the relevant texts and lines from the
scaled group, then computed 
and assigned their required new coordinates after every scale operation.
Laborious, but it seems to 
be the only way - but I'm a relative newby at SVG, so maybe someone
knows a better way.

The problem is that it isn't possible to exclude the font size or
stroke-width from scaling operations 
in SVG.

George

--- In [email protected]
<mailto:svg-developers%40yahoogroups.com> , Peter Thompson
<[EMAIL PROTECTED]> wrote:
>
> Does this do what you want?
> 
> <?xml version="1.0"?>
> <svg xmlns="http://www.w3.org/2000/svg"; width="100%" height="100%">
> <circle cx="50" cy="200" r="2" stroke="green" stroke-width="1"
fill="green"/>
> <g id="Labels" transform="translate(50,200)" font-size="20pt"
fill="red">
> <text>Text scales, but doesn't change font size.</text>
> </g>
> <script>
> <![CDATA[
> function SyncUI()
> {
> var root = document.rootElement;
> var scaleUI = 1/parseFloat(root.currentScale);
> var obj = document.getElementById("Labels");
> obj.setAttribute("font-size", (20 * scaleUI) + "pt");
> }
> document.rootElement.addEventListener( "SVGScroll", SyncUI, false );
> document.rootElement.addEventListener( "SVGResize", SyncUI, false );
> document.rootElement.addEventListener( "SVGZoom", SyncUI, false );
> SyncUI();
> // ]]>
> </script>
> </svg>
> 
> --- On Sun, 9/7/08, gfc22 <[EMAIL PROTECTED]> wrote:
> From: gfc22 <[EMAIL PROTECTED]>
> Subject: [svg-developers] Non-scalable text labels in scalable
graphics?
> To: [email protected]
<mailto:svg-developers%40yahoogroups.com> 
> Date: Sunday, September 7, 2008, 8:48 AM
> 
> I expect this is a FAQ, but Google doesn't offer anything relevant:
> 
> I have text labels in scalable SVG groups. I want the positions of the
labels to scale with the 
> other elements but not their text size. This must be a common
requirement. Suggestions 
> welcome.
> 
> George
> 
> 
> 
> 
> 
> 
> [Non-text portions of this message have been removed]
>

 



[Non-text portions of this message have been removed]


------------------------------------

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
----Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to