| Page 1 of 1 | [ 6 posts ] |
|
In my work I am heavily using events and drag/drop. So far things are relatively simple during mockup and demo data dev work.
I will have a bunch of items on a page that can be dragged around and connected together in various manners As I progress though I will be running into possible scenarios where I will have the following #'s on a page: ~50-100 click/mousedown element checks implemented via Delegate method using class selection ~10-15 mousedown element checks implemented via Delegate method using class selection ~30-75 drag/drop elements also including an almost equivalent number of available drop zones for each element. {each element will have drag:start,drag:drag,drag:drop checks} ~5-10 timers triggering various background tasks and io requests Main question is between work Y! team members have encountered internally or folks in community are they any performance implications people have encountered and reached some limits on a smooth UX? Trying to use Delegate style event handling where possible instead of instatiating whole event objects. Right now my main concern is over proper methodology around the drop elements since I have a large number of permutations for possible drag/drop groups. |
|
This is the recommended approach, even more so in 3.1.0 coming out next year.
I have recently added a new DD class to 3.x to help with this very issue, if you want to live on the edge and try it, feel free: http://github.com/yui/yui3/tree/master/build/dd/ There is a new submodule called 'dd-delegate' and you use it like this: DD.DelegateClick here to see the revision history on this Gist. |
|
Thanks Dav,
I am playing around with a couple different methodologies I have been working on as I have been flushing out my own architecture. So far the first delegate stuff I have done seems to work great so I will try this new stuff out and let you know how it goes. |
|
Hey Dav,
Sorry for delay, just getting back to testing out the new delegate stuff. I got the basics working but dont know if I am experiencing a bug or intended behavior. It appears that the class selectors are only queried/applied to the containers first level of children and not all children nested multiple levels deep? I have a main workspace container with <div>'s inside. Inside those children <div>'s are another set which are the ones I am trying to get at. Will play around some more and look at the class code a bit to see if I am missing a config option somewhere that effects behavior |
|
Ok Dav, moving things along, new delegate stuff is pretty sweet,
With regards to the 1st level children or all children being queried, still seem to get the behavior of just 1st level children. I see your comment "All nodes should be a child of this container", and this: items = Y.one(self.get(CONT)).all(self.get(NODES)); Two other things I came across which I dont know are bugs are just part of the changes, One is with regular DD, you are able to use this.get('node') inside an drag::* function to get the drag node object. It seems that has changed to this.get('currentNode'); Other one is the last piece of the puzzle I am tinkering with is Proxy. I am able to .plug it, no complaints/errors but no proxy behavior happens. I assume since its in an early state it hasnt been implemented or just something funky going on.., or I am just using it wrong: var dragDelegate = new Y.DD.Delegate({ cont:'#'+compElemID, nodes:'.available'} ).plug(Y.Plugin.DDProxy, { borderStyle: false, moveOnEnd: false }); |
|
I found that you can add a plug to the delegate after it's created. I used the delegate to allow draggable elements to be created/destroyed after the page load. However, I needed to used the constrain logic as well. Here's the code i used:
Code: YUI().use('dd-constrain', 'dd-delegate', function(Y) { var del = new Y.DD.Delegate({ cont: '#canvas', //The common container nodes: '.draggableControl' //The items to make draggable }); del.dd.plug(Y.Plugin.DDConstrained, {constrain2node: '#canvas'}); //Constrain the items to the canvas element }); |
| Page 1 of 1 | [ 6 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group