| Issue 163: | drag and drop markers: offset is sometimes calculated incorrectly | |
| 2 people starred this issue and may be notified of changes. | Back to list |
First thanks for this greay tool !
I'm currently implementing it in the Yacs CMS (www.yacs.fr) and i've
made some corrections for the drag and drop support.
First correction is for the case that the tree is in a container and not directly
under the body level.
In this case, the tree may not be in position 0,0, so you have to be
careful of the conainer offset while determining the hitmode in the
_onDragEvent function.
You also have to append the dndMarker to the container of the tree and
not directly on the body tag, otherwise it won't be on current
position.
So here are the changes i've made and i'd like you to integrate in
your code :
- line 1930 in the initialize function of the tree :
var parentPos = $(this.divTree).parent().offset();
this.parentTop = parentPos.top;
this.parentLeft = parentPos.left;
to memorize the parent offset.
- line 2401 (line 2397 in the original source) :
.prependTo($(this.divTree).parent()); // instead
of .prependTo("body");
- line 2543 (after line 2538 in the original source) :
nodeOfs.top += this.parentTop;
nodeOfs.left += this.parentLeft;
to take count of the parent offset
UPDATE: ther's also a problem with large trees that need to be scrolled; in this case, there is a problem in calculating hitMode from relative cursor position because you work with clientX/clientY that doesnt care about scrolling; you have to work with pageX/pageY in line 2545 of my corrected source (see joined file):
var relPos = { x: event.pageX - nodeOfs.left, y: event.pageY - nodeOfs.top };
thanks again for dynatree
Tof
Nov 15, 2010
I commited your patch, thanks!
Summary:
drag and drop markers: offset is sometimes calculated incorrectly
Status: Fixed
Nov 18, 2010
Re-opened: seems that the change has broken the drop functionality: (It' not possible to drop *over* a node, just before)
Status:
Accepted
Labels: -Priority-Medium -Milestone-Release1.0 Priority-Critical Milestone-Release1.0.1
Jul 17, 2012
considered verified
Jul 17, 2012
(No comment was entered for this change.)
Status:
Verified
|
Status: Accepted
Owner: moo...@wwwendt.de
Labels: Milestone-Release1.0