| Issue 418: | drag-n-drop marker positioned incorrectly when tree in a tab (jQuery 1.9.1, jQuery-UI 1.10.2) | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem?
1.Create tab with jQuery-UI
2.Place Tree in the tab
3.Drag.
dynatree version is 1.2.4
I opened the code and found this:
this.$dndMarker
.show()
.position({
my: "left top"
at: "left top"
of: $target,
offset: markerOffset <--- not working for some reason
});
I fixed that for me and wanted to leave a sign for other users. Might be helpful. The fix is:
var markerOffset = "0 0";
var my = "left center"; <-- new line
var at = "left center"; <-- new line
switch(hitMode){
case "before":
this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-over");
this.$dndMarker.addClass("dynatree-drop-before");
markerOffset = "0 -8";
my = "left bottom"; <-- new line
at = "left center"; <-- new line
break;
case "after":
this.$dndMarker.removeClass("dynatree-drop-before dynatree-drop-over");
this.$dndMarker.addClass("dynatree-drop-after");
markerOffset = "0 8";
my = "left center"; <-- new line
at = "left bottom"; <-- new line
break;
default:
this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-before");
this.$dndMarker.addClass("dynatree-drop-over");
$target.addClass("dynatree-drop-target");
markerOffset = "8 0";
}
this.$dndMarker
.show()
.position({
my: my,//"left top" <-- updated
at: at,//"left top" <-- updated
of: $target,
offset: markerOffset
});
I am using only "before" and "after" cases, so this works perfectly for both, but for "over" will need fine tuning, I guess. Have not tested that case.
And... guys, dynatree ROCKSSS!!! LOVE IT!!!
Jul 2, 2013
My Solution would be like this:
Original code:
this.$dndMarker
.show()
.position({
my: "left top"
at: "left top"
of: $target,
offset: markerOffset <--- not working (http://blog.jqueryui.com/2010/12/position-api-redesign/)
});
New Code:
this.$dndMarker
.show()
.position({
my: "left+"+markerOffset.split(" ")[0]+ " top+"+markerOffset.split(" ")[1],
at: "left top",
of: $target
});
Jul 2, 2013
Thanks, this was already solved with issue #411
May 2, 2014
Cleanup Scrumboard
Labels:
Milestone-Release2.0
|
Mergedinto: 411