Side navigation
#1437 closed bug (wontfix)
Opened July 30, 2007 07:16AM UTC
Closed March 31, 2008 01:27AM UTC
Sortables didn't recognize scroll offset to find new position
Reported by: | Stuck Mojo | Owned by: | stefan |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | interface | Version: | |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
<style type="text/css" media="all"> .sortHelper { border: 3px dashed #666; width: auto !important; } </style> <div id="sort1" class="groupWrapper" style="height:150px;width:200px;overflow:auto;"> <div class="groupItem">A</div> <div class="groupItem">B</div> <div class="groupItem">C</div> <div class="groupItem">D</div> <div class="groupItem">E</div> <div class="groupItem">F</div> <div class="groupItem">G</div> <div class="groupItem">H</div> <div class="groupItem">I</div> <div class="groupItem">J</div> <div class="groupItem">K</div> <div class="groupItem">L</div> <div class="groupItem">M</div> <div class="groupItem">N</div> <div class="groupItem">O</div> <div class="groupItem">P</div> <div class="groupItem">Q</div> <div class="groupItem">R</div> </div> <script type="text/javascript"> $(document).ready( function () { $('div.groupWrapper').Sortable( { accept: 'groupItem', helperclass: 'sortHelper', tolerance: 'pointer' } ); } ); </script>
...just scroll some ticks down and try to drag an entry. The new position will not recogize the current offset of the scrollbars and will be calculated wrong.
A quick fix for me:
jQuery.iSort.checkhover = function(e,o) { if (!jQuery.iDrag.dragged) return; var cur = false; var i = 0; // get the scroll data var tScroll = jQuery.iUtil.getScroll(jQuery.iDrop.overzone); if ( e.dropCfg.el.size() > 0) { for (i = e.dropCfg.el.size(); i >0; i--) { if (e.dropCfg.el.get(i-1) != jQuery.iDrag.dragged) { if (!e.sortCfg.floats) { if ( (e.dropCfg.el.get(i-1).pos.y - tScroll.t + e.dropCfg.el.get(i-1).pos.hb/2) > jQuery.iDrag.dragged.dragCfg.ny ) { cur = e.dropCfg.el.get(i-1); } else { break; } } else { if ( (e.dropCfg.el.get(i-1).pos.x - tScroll.l + e.dropCfg.el.get(i-1).pos.wb/2) > jQuery.iDrag.dragged.dragCfg.nx && (e.dropCfg.el.get(i-1).pos.y - tScroll.t + e.dropCfg.el.get(i-1).pos.hb/2) > jQuery.iDrag.dragged.dragCfg.ny ) { cur = e.dropCfg.el.get(i-1); } } } } } //helpos = jQuery.iUtil.getPos(jQuery.iSort.helper.get(0)); if (cur && jQuery.iSort.inFrontOf != cur) { jQuery.iSort.inFrontOf = cur; jQuery(cur).before(jQuery.iSort.helper.get(0)); } else if(!cur && (jQuery.iSort.inFrontOf != null || jQuery.iSort.helper.get(0).parentNode != e) ) { jQuery.iSort.inFrontOf = null; jQuery(e).append(jQuery.iSort.helper.get(0)); } jQuery.iSort.helper.get(0).style.display = 'block'; }
Best regards,
Jan
The above code mostly fixed the issue, however, when you have something like:
There are two issues:
Here is a patch, incorporating all of the fixes: