Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature idea/request: delegating events to a containerelement #3

Open
maerten opened this issue Feb 19, 2012 · 4 comments
Open

feature idea/request: delegating events to a containerelement #3

maerten opened this issue Feb 19, 2012 · 4 comments

Comments

@maerten
Copy link

maerten commented Feb 19, 2012

Hi!

Binding Touchy.js on 40+ elements on iOS (iPhone 4) casues my webapps UI to hang for a few seconds. Using event delegation should speed things up.

    Touchy(element, callback(hand, finger) {} );

could become:

    Touchy(containerelement, cssSelector, callback(hand, finger, element) {} );

or something like

    Touchy(containerelement, cssSelector, callback(hand, finger) {
      // finger.element
    } );
@jairajs89
Copy link
Owner

Interesting. I haven't stress tested this at all since I wrote it for simple touch interactions on two elements for a project of mine. I'll look into it. I'm thinking of changing the format this library to allow developers to turn on/off Touchy instances so that you can manage efficiency as needed.

I'm curious though, why do you have 40+ elements on a page with touch interactions?

@maerten
Copy link
Author

maerten commented Feb 21, 2012

Alright, sounds great!

About the 40+ elements.. It's a scrollable list of items. I'm trying to replicate the behavior of different iphone UI elements. So a back-button works great with touchy as it is now, but a scrollable list gets problematic for performance reasons. I don't want to use raw touch events, right now I like the idea that if i can get things to work for 1 finger (the main use case), adding interaction for more fingers should only be a small extra step.

Another use-case of delegates that comes to mind: on a list, multitouch interaction can be done with multiple elements at the same time. I could for example use 1 finger for scrolling the list (on which the touch events are bound) and selecting items for viewing (by finding the event.srcElement). Then the lists' behavior could be extended: by holding down the thumb on the bottom of the list (to "keep it in place") and then using the index finger to move an element around in the list. (I think that right now, multitouch interaction only applies to the attached element?).

p.s. if you want i can send you my adapted TouchyDelegate.js version, just write me a message

@bitfool
Copy link

bitfool commented Apr 26, 2012

I would like this! Maerten, I'd like to see your TouchyDelegate.js version. I just started work with Touchy today, but will likely have as many as 100 or more elements, and I need good cross platform interactivity (ie, works well both on iPad and browsers).

FWIW, I'm developing a cross-platform web app that has quite complex interactions. Buttons move around when "flicked" with a touch, moving not only around the screen but changing place in the DOM to provide robust grouping. I'm in need of a library like this, and will be stress testing it thoroughly. Thanks.

@RobbinHabermehl
Copy link

Ideally, more specific events would be extremely useful as well in combination with the implementations suggested by Maerten. The events would be tap(/click), double tap (/double click) and hold. This would make Touchy the perfect interaction control!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants