uxebu / bonsai

BonsaiJS is a graphics library and renderer
http://bonsaijs.org
Other
1.96k stars 189 forks source link

Attach event into a mask #174

Open wallynm opened 11 years ago

wallynm commented 11 years ago

There's a way to attach a event like mouse over into a mask? This example shows what i don`t wanna: http://goo.gl/DRhsH

When you pass the mouse NEXT to the box, it changes the color from the mask, what i would like to do is to just call that event WHEN the mouse pass over blue box, because i need to work with only the displayed image, and binding a event like that should solve my problem.

i tried to bind the click/mouseover into a group but it keeps the same result, the whole image is acessible, and not just the part viewed. I also tried to clip it, but it keep tracking the content clipped

Ty guys, and sorry again by posting this question here.

davidaurelio commented 11 years ago

Thanks for reporting, @wallysson,

this is a bug, of course. We’ll need to investigate whether the root of this behavior is SVG in general, or a specific implementation. I can’t make any prediction when it will be fixed, but hopefully soon. We’ll keep you updated here.

wallynm commented 11 years ago

Don''t worry with it... I already have a workarround for it, i made a helper which is a shape transparent that represents the place of contact of their mask and placed it above of the shape, so i can bind my events just when user hover on my target.

If you would like the code to see what i did to handle it, i can post here... Ty by the attention!

iamdustan commented 11 years ago

I think this would be expected behavior in SVG since the mask element is located in the defs which has similarities to the head of an html document.

wallynm commented 11 years ago

I've tryed to bind events like on click and hover using jQuery outside bonsai code. I've tryed on the defs and paths tags, but it didn't worked... Any of the events was trigered...