Andrew, You could get the bounding box of the clip path and then just work out the intersection of the two rectangles. See the answer here for more details
http://stackoverflow.com/questions/10430518/getting-a-display-bounding-box-for-a-clipped-object/10433013#10433013 Best regards Robert. --- In svg-developers@yahoogroups.com, Andrew Shellshear <andrew@...> wrote: > > Hello SVGers, > > The getBBox method (by design) doesn't take into account clipping. Is there > a method that does, or failing that, has anyone written some javascript to > do it? > > For example: > > <svg id="foo" x="0" y="0" width="100" height="100"> > <rect width="200" height="200" fill="red" stroke="black"/> > </svg> > > document.getElementById("foo").getBBox() would return {x:0, y:0, width:200, > height:200}. > I need {x:0, y:0, width:100, height:100}. > > (Some context: I'm writing a scrollbar widget - yes, I know, I know - and > currently I can't put a scrollable area inside another scrollable area, > because getBBox ignores my attempts at clipping.) > > I started trying to write something myself, but I'm getting bogged down > with the various matrix transforms you need to do to make this work > generally. > I figure you have to rewrite getBBox() in javascript, but at each stage > checking if there's an svg element, or a clip-path, etc. and use > combinations of getBBox(), getScreenCTM(), getTranformToElement(), etc. > > Have any of you done this or seen it done? > > Cheers, > > Andrew Shellshear. > > > [Non-text portions of this message have been removed] > ------------------------------------ ----- To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com -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: svg-developers-dig...@yahoogroups.com svg-developers-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: svg-developers-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/