You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: dragging children will not change their position
Posible solution: from gdx 1.9.* addActor*() methods will do nothing when child is already on the group. So we need to remove the actor before calling these methods.
Code snippet:
protected boolean addToHorizontalGroup (final Actor actor, final DragPane dragPane, final Actor directPaneChild) {
final Array<Actor> children = dragPane.getChildren();
final int indexOfDraggedActor = children.indexOf(actor, true);
final int indexOfDirectChild = children.indexOf(directPaneChild, true);
actor.remove(); // gdx 1.9.6 addActor*() expects children are not added in the group before
if (indexOfDraggedActor >= 0) {
if (indexOfDirectChild > indexOfDraggedActor) {
dragPane.addActorAfter(directPaneChild, actor);
} else {
dragPane.addActorBefore(directPaneChild, actor);
}
} else if (DRAG_POSITION.x > directPaneChild.getWidth() / 2f) {
dragPane.addActorAfter(directPaneChild, actor);
} else {
dragPane.addActorBefore(directPaneChild, actor);
}
return APPROVE;
}
The text was updated successfully, but these errors were encountered:
Looks like @Honguito98 already figured out the issue - @Honguito98, would you mind creating a pull request with your changes? Keep in mind that this approach should be applied to other group handling methods.
Well I added it but the behavior with tabbed pane seems different than before. Most of the time actor gets added one actor after the actor it was dropped on. But only when dragging from left to right. Dragging from right to left seems to work fine.
addActor*()
methods will do nothing when child is already on the group. So we need to remove the actor before calling these methods.The text was updated successfully, but these errors were encountered: