I'll give it a try. I guess in this case I'd have to pass the color as
an argument and on load swap the fill from blue to another color value.
Will this work if I have multiple shapes referencing the same pattern
def?     

 

Brendan Carroll 
Senior Developer 
Baltimore GIS Manager 
GeoDecisions(r) 
Suite A, 4701 Mount Hope Drive 
Baltimore, MD. 21215 
(410) 585-1460 Office 
(443) 610-5650 Cell 
[EMAIL PROTECTED] 

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of ddailey
Sent: Sunday, February 04, 2007 10:53 AM
To: [email protected]
Subject: Re: [svg-developers] Patterns

 

Brendan asks about dynamically changing the content of a pattern.

defs>
<pattern id="checkerPattern" patternUnits="userSpaceOnUse"
x="0" y="0" width="20" height="20"
viewBox="0 0 15 15" >
<rect x="0" y="0" width="10" height="5" fill="blue"/>
<rect x="5" y="5" width="15" height="5" fill="blue"/>
</pattern> 
</defs> 

I thought I had an example around somewhere but didn't find it easily...
Yes, what you wish to do can be done.

I'd do something like 

changePattern("checkerPattern","newPatternGroup")

where:
function changepattern(id,newgroupid){
var P=document.getElementById(id)
for (i in P.childnodes){
P.removeChild(P.items(i))
}
//above should clean out the existing stuff in the pattern
//then add the new stuff
var G=document.getElementById(newgroupid)
P.appendChild(G)
}

where newPatternGroup would be a group (probably defined in <defs>)
containing the elements of the new pattern.

I think that oughta work in browsers that support <pattern>

hope this helps
David

[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