mar10 / dynatree

Automatically exported from code.google.com/p/dynatree
92 stars 37 forks source link

drag-n-drop marker positioned incorrectly when tree in a tab (jQuery 1.9.1, jQuery-UI 1.10.2) #418

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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!!!

Original issue reported on code.google.com by stoyanov...@gmail.com on 8 Apr 2013 at 8:46

GoogleCodeExporter commented 9 years ago
Tranks!
Sems to be related to #411

Original comment by moo...@wwwendt.de on 9 Apr 2013 at 5:11

GoogleCodeExporter commented 9 years ago
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
});

Original comment by s.rangl...@gmail.com on 2 Jul 2013 at 3:51

GoogleCodeExporter commented 9 years ago
Thanks, this was already solved with issue #411

Original comment by moo...@wwwendt.de on 2 Jul 2013 at 5:40

GoogleCodeExporter commented 9 years ago
Cleanup Scrumboard

Original comment by moo...@wwwendt.de on 2 May 2014 at 7:47