diff --git a/CHANGES b/CHANGES index b19ea4d..159cb64 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,12 @@ Glow Changelog +1.7.0-exoweb2 +* glow.dragdrop - Fixed issue that the position detection acts weird sometimes. + +1.7.0-exoweb + +* glow.dragdrop - Added position detection for float:left elements. + 1.7.0 * glow.widgets.Autosuggest - Fixed bug that sometimes caused the suggestion list to be position off by 1 pixel diff --git a/build.properties b/build.properties index ff796ff..7a71762 100644 --- a/build.properties +++ b/build.properties @@ -1,3 +1,3 @@ LINE=1.7 -VERSION=1.7.0 +VERSION=1.7.0-exoweb2 CSSVERSION=170 diff --git a/src/dragdrop/dragdrop.js b/src/dragdrop/dragdrop.js index 1f07f9d..d72d970 100644 --- a/src/dragdrop/dragdrop.js +++ b/src/dragdrop/dragdrop.js @@ -615,6 +615,7 @@ placeholder.css('top', startTop + 'px'); } placeholder.css('position', position); + placeholder.css('float', el.css('float')); }, /* @@ -1269,14 +1270,18 @@ childBoxes = activeTarget._childBoxes, children = activeTarget._children; box.resetPosition(); - var totalHeight = activeTarget._box.innerTopPos(); - var draggablePosition = mousePos.y - box.offsetParentPageTop(); + var currTop = lastTop = activeTarget._box.innerTopPos(); + var currTop = lastLeft = activeTarget._box.innerLeftPos(); + var draggableLeft = box.offsetLeft() + box.outerWidth() / 2; + var draggableTop = box.offsetTop() + box.outerHeight() / 2; var placed = 0; for (var i = 0, l = childBoxes.length; i < l; i++) { if (children[i] == this.element[0]) continue; childBox = childBoxes[i]; - totalHeight += childBox.outerHeight(); - if (draggablePosition <= totalHeight) { + currTop = childBox.offsetTop() + childBox.outerHeight(); + currLeft = childBox.offsetLeft() + childBox.outerWidth(); + + if (draggableTop <= currTop && draggableLeft <= currLeft || currLeft <= lastLeft && currTop > lastTop && draggableTop <= lastTop && draggableLeft > lastLeft) { if (activeTarget._dropIndicatorAt != i) { $(childBox.el).before(activeTarget._dropIndicator); activeTarget._dropIndicatorAt = i; @@ -1284,6 +1289,8 @@ placed = 1; break; } + lastTop = currTop; + lastLeft = currLeft; } if (! placed) { if (childBox) { @@ -1634,6 +1641,8 @@ var childBoxes = this._childBoxes = []; children.each(function (i) { childBoxes[i] = new Box($(children[i])); + childBoxes[i].offsetLeft(); + childBoxes[i].offsetTop(); }); },