#1680 closed bug (fixed)
Sortables in scroll render incorrectly when dragging
Reported by: | sqrrrl | Owned by: | zimbatm |
---|---|---|---|
Priority: | major | Milestone: | 1.5 |
Component: | ui.core | Version: | 1.2.1 |
Keywords: | ui | Cc: | |
Blocked by: | Blocking: |
Description
The drag helper position is incorrectly calculated when the container has overflow set to scroll. It is fine so long as the area has not been scrolled, but the further down you go, the further away from the cursor the helper is positioned. Example code:
<!DOCTYPE html PUBLIC "-W3CDTD HTML 4.01EN" "http://www.w3.org/TR/html4/strict.dtd">
<html> <head>
<script type="text/javascript" src="jquery-1.2.1.js"></script> <script type="text/javascript" src="metadata.js"></script> <script type="text/javascript" src="jqueryui/ui.mouse.js"></script> <script type="text/javascript" src="jqueryui/ui.draggable.js"></script> <script type="text/javascript" src="jqueryui/ui.draggableext.js"></script> <script type="text/javascript" src="jqueryui/ui.droppable.js"></script> <script type="text/javascript" src="jqueryui/ui.droppable.ext.js"></script> <script type="text/javascript" src="jqueryui/ui.sortable.js"></script> <script type="text/javascript">
$(document).ready( function() {
var container = $('div#container'); for( i = 0; i < 100; ++i ) {
$( '<div class="item">Item ' + i + '</div>' ).appendTo( container );
} container.sortable( { items: 'div.item' } );
});
</script> <style> div#container {
height: 100px; overflow-y: scroll;
} </style> <title></title> </head>
<body>
<p>Scroll Test</p>
<div id="container"/>
</body> </html>
Attachments (2)
Change History (12)
Changed 16 years ago by
Attachment: | ui.sortable.js added |
---|
comment:1 follow-up: 4 Changed 16 years ago by
Attached a fix... making helper fixed position and adjusting offsets a little seems to make it better. Attached version also has some performance tweaks.
comment:2 Changed 16 years ago by
Owner: | set to paul |
---|
comment:3 Changed 16 years ago by
Status: | new → assigned |
---|
comment:4 Changed 16 years ago by
Owner: | changed from paul to sqrrrl |
---|---|
Status: | assigned → new |
Replying to sqrrrl:
Attached a fix... making helper fixed position and adjusting offsets a little seems to make it better. Attached version also has some performance tweaks.
sqrrrl, this does not seem to work as expected. I've tried your version against the test (plugin/ui/test/sortable.html), the helper is positioned at the very bottom of the page, the mouse position is not relative to where you picked the element at and the floating example doesn't work correctly anymore.
It would still be great to see a working version of your performance improvements- keep me updated!
comment:5 Changed 15 years ago by
Owner: | changed from sqrrrl to zimbatm |
---|
Changed 15 years ago by
Attachment: | draggable_overflow_test.diff added |
---|
Updated tests with overflow containerr
comment:6 Changed 15 years ago by
This seems to be a fixed problem.
IMHO, it was related to broken position calculation, which comes from the core.
Before closing the ticket, I'd like to fix another problem where my new items gets smaller with when dragged.
comment:8 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:10 Changed 14 years ago by
Milestone: | → 1.5 |
---|
Modified sortable to fix rendering in scrollable containers, some perf improvements.