Tom Wilcoxen
2005-Aug-15 15:42 UTC
[Rails-spinoffs] Possible to scroll window when user drags a draggable?
It doesn''t seem to be possible, but perhaps somebody knows a trick. I have some lists that get too long and users can''t drag from list 10, for example, to list 1. Is there a way to get the browser window to scroll as they drag the item up? Thanks! Tom
Martin Bialasinski
2005-Aug-16 11:15 UTC
[Rails-spinoffs] Possible to scroll window when user drags a draggable?
On 15/08/05, Tom Wilcoxen <tomwilcoxen@gmail.com> wrote:> It doesn''t seem to be possible, but perhaps somebody knows a trick. I > have some lists that get too long and users can''t drag from list 10, > for example, to list 1. Is there a way to get the browser window to > scroll as they drag the item up?You can query the mouse position in the viewport and scroll, when you are at the top/bottom. You could extract the relevant pieces in my hacked Sortable version at http://test.reasonmaker.com/sort/ (look for scroll). Note my caching of the viewport height so I don''t have to query every time, which is slow. And also the onresize handler so that it gets updated on window size changes. Bye, Martin
Tom Wilcoxen
2005-Aug-16 12:59 UTC
[Rails-spinoffs] Possible to scroll window when user drags a draggable?
Martin, Thanks, that''s just what I''m looking for. From looking through your code it looks like I''d need the relevant portions from your dragdrop.js plus your utils.js -- is that correct? This would be a great addition to Draggables... (hint, hint) :) Thanks! Tom On 8/16/05, Martin Bialasinski <klingeling@gmail.com> wrote:> On 15/08/05, Tom Wilcoxen <tomwilcoxen@gmail.com> wrote: > > It doesn''t seem to be possible, but perhaps somebody knows a trick. I > > have some lists that get too long and users can''t drag from list 10, > > for example, to list 1. Is there a way to get the browser window to > > scroll as they drag the item up? > > You can query the mouse position in the viewport and scroll, when you > are at the top/bottom. You could extract the relevant pieces in my > hacked Sortable version at http://test.reasonmaker.com/sort/ (look for > scroll). > > Note my caching of the viewport height so I don''t have to query every > time, which is slow. And also the onresize handler so that it gets > updated on window size changes. > > Bye, > Martin >
Martin Bialasinski
2005-Aug-16 15:37 UTC
[Rails-spinoffs] Possible to scroll window when user drags a draggable?
On 16/08/05, Tom Wilcoxen <tomwilcoxen@gmail.com> wrote:> Thanks, that''s just what I''m looking for.You are welcome.> From looking through your > code it looks like I''d need the relevant portions from your > dragdrop.js plus your utils.js -- is that correct?I think you don''t need my additions to utils.js. To speed up everything for my vertical-only lists, I made functions that only deal with the Y position, where originally X & Y is used/returned. Just rewrite my code a bit to use the Y part.> This would be a great addition to Draggables... (hint, hint) :)The problem is, I am quite busy currently. And the thing needs some more work to be of general usefulness. Well, isolate the scroll part, make it also work for horizontal scrolling (it is analogous really), make it configurable and submit a patch :-) Better ask Thomas first, if he would accept it and what his requirements are on this (for example, with my code, you can scroll past the document length; No problem for me, but I AFAIR he doesn''t like it that way). Bye, Martin
Dave Strus
2005-Aug-16 15:40 UTC
[Rails-spinoffs] Possible to scroll window when user drags adraggable?
I think the scrolling effect would be a terrific addition. Very cool, Martin! -----Original Message----- From: rails-spinoffs-bounces@lists.rubyonrails.org [mailto:rails-spinoffs-bounces@lists.rubyonrails.org] On Behalf Of Tom Wilcoxen Sent: Tuesday, August 16, 2005 1:33 PM To: Martin Bialasinski Cc: rails-spinoffs@lists.rubyonrails.org Subject: Re: [Rails-spinoffs] Possible to scroll window when user drags adraggable? Martin, Thanks, that''s just what I''m looking for. From looking through your code it looks like I''d need the relevant portions from your dragdrop.js plus your utils.js -- is that correct? This would be a great addition to Draggables... (hint, hint) :) Thanks! Tom On 8/16/05, Martin Bialasinski <klingeling@gmail.com> wrote:> On 15/08/05, Tom Wilcoxen <tomwilcoxen@gmail.com> wrote: > > It doesn''t seem to be possible, but perhaps somebody knows a trick. I > > have some lists that get too long and users can''t drag from list 10, > > for example, to list 1. Is there a way to get the browser window to > > scroll as they drag the item up? > > You can query the mouse position in the viewport and scroll, when you > are at the top/bottom. You could extract the relevant pieces in my > hacked Sortable version at http://test.reasonmaker.com/sort/ (look for > scroll). > > Note my caching of the viewport height so I don''t have to query every > time, which is slow. And also the onresize handler so that it gets > updated on window size changes. > > Bye, > Martin >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Thomas Fuchs
2005-Aug-17 02:21 UTC
[Rails-spinoffs] Possible to scroll window when user drags a draggable?
This would sure be a welcome addition. What I want to see in an implementation is autoscrolling containers (when the CSS says so). So, it should seek the first parent that is scrollable and use that element for scrolling. Thomas Am 16.08.2005 um 23:10 schrieb Martin Bialasinski:> >> This would be a great addition to Draggables... (hint, hint) :) >> > > The problem is, I am quite busy currently. And the thing needs some > more work to be of general usefulness. Well, isolate the scroll part, > make it also work for horizontal scrolling (it is analogous really), > make it configurable and submit a patch :-) Better ask Thomas first, > if he would accept it and what his requirements are on this (for > example, with my code, you can scroll past the document length; No > problem for me, but I AFAIR he doesn''t like it that way).
Tom Wilcoxen
2005-Aug-17 12:37 UTC
[Rails-spinoffs] Possible to scroll window when user drags a draggable?
I''m swamped this week, but maybe in the next couple I''ll have a chance to take a look at it. Thanks! Tom On 8/17/05, Thomas Fuchs <thomas@fesch.at> wrote:> This would sure be a welcome addition. > > What I want to see in an implementation is autoscrolling containers > (when the CSS says so). > So, it should seek the first parent that is scrollable and use that > element for scrolling. > > Thomas > > Am 16.08.2005 um 23:10 schrieb Martin Bialasinski: > > > > >> This would be a great addition to Draggables... (hint, hint) :) > >> > > > > The problem is, I am quite busy currently. And the thing needs some > > more work to be of general usefulness. Well, isolate the scroll part, > > make it also work for horizontal scrolling (it is analogous really), > > make it configurable and submit a patch :-) Better ask Thomas first, > > if he would accept it and what his requirements are on this (for > > example, with my code, you can scroll past the document length; No > > problem for me, but I AFAIR he doesn''t like it that way). >