Hmm... I don't really want to be handling this at such a high level. Ideally, ART would sort all of this out in its SVG/VML separation. I'll have a think about this and see if I can come up with something.

Anyway, I'm thoroughly enjoying working with ART. I'm putting together a graphing package, kind of like gRaphael, but Moo-ier and with easier-to-follow code... https://github.com/barryvan/art/Testing . An hour here and there, and I've already got something I'm pretty happy with. Kudos to the ART team!

On 26/01/11 21:37, Arian Stolwijk wrote:
You can't use usual delegation (from mootools-more). However since it's SVG/VML, I think the events bubble like normal DOM. So if you subscribe (addEvent equivalent) an event to an element, which contains other elements, the parent elements will fire the event as well. So you could inspect the event object (probably the first argument) to see if there's something useful.

myElement.subscribe('click', function(event){
    console.dir(event);
});

Probably you can't check for event.target.tagName or use Slick.match(event.target, 'a.class'); because the tagnames might be different between SVG and VML. You should probably experiment a bit because I'm not sure about it either yet ;)


On Wed, Jan 26, 2011 at 4:23 AM, Barry van Oudtshoorn <[email protected] <mailto:[email protected]>> wrote:

    Jumping on the bandwagon... I've been playing with ART a bit, and
    I've got to say that I'm quite enjoying it.

    However, I'm not entirely sure about event handling --
    particularly delegation. Let's say I want to render a line-graph
    (which I do), and allow the user to hover over points in that
    graph to see more detailed information, or click on those points
    to perform some action. Yes, I can add events to each point that I
    render, but that could cause trouble when the number of points
    starts getting high. It also doesn't feel very tidy. I understand
    that the complexity here is probably because of the difference
    between SVG and VML.

    Any ideas on an elegant solution? Is this something that's been
    considered for ART's future, and, if so, what's the best way
    forward in the light of that?

    - Barry

    http://barryvan.com.au/
    [email protected] <mailto:[email protected]>




--
Barry van Oudtshoorn
www.barryvan.com.au

Not sent from my Apple ?Phone.

Reply via email to