I’m doing Nifty drag and drop based on the examples and what I have is an abilities window and a hotbar. I drag abilities to my hotbar from the window. This all works fine except that I want the abilities to stay in the window when they are dragged instead of being removed from there. Can I clone the dragged element when the drag starts somehow? Has anybody done something like this?
Choose a Nifty event trigger such as DraggableDragStartedEvent or DroppapleDroppedEvent to initiate a method such as:
public void MakeCityWallIcon(){
if(walls.size()>50){
return;
}
Screen s = nifty.getScreen(“levelmaker”);
Element parent = s.findElementByName(“iconBin”);
final String id = “cityWallIcon”+randomColor();
Element draggable = new DraggableBuilder(“dragwall”+id){{
childLayoutCenter();
revert(true);
image(new ImageBuilder(“cityWall”+id){{
filename(“Textures/gui/cityWall.png”);
}});
}}.build(nifty, s, parent);
Element cityWall = s.findElementByName(“dragwall”+id);
walls.add(cityWall);
draggable.setParent(parent);
}