Nifty draggable + scrollpanel problem

Hey.



I’m back with another problem.

This time it’s about draggables and scroll panels (hence the topic)…



If i enclose draggables inside a scroll panel and drag them outside into a droppable, nifty freezes completely. Without the scroll panel, it works fine.



Here’s another test case (based on the example jar):



Try to drag one of the boxes unto a droppable and see what happens



[java]package mygame;



import com.jme3.app.SimpleApplication;

import com.jme3.niftygui.NiftyJmeDisplay;

import com.jme3.renderer.RenderManager;

import de.lessvoid.nifty.Nifty;

import de.lessvoid.nifty.screen.Screen;

import de.lessvoid.nifty.screen.ScreenController;



public class Main1 extends SimpleApplication implements ScreenController {



private Nifty nifty;



public static void main(String[] args) {

Main1 app = new Main1();

app.start();

}



@Override

public void simpleInitApp() {

NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);

nifty = niftyDisplay.getNifty();

guiViewPort.addProcessor(niftyDisplay);



flyCam.setEnabled(false);



nifty.fromXml(“Interface/dragndrop.xml”, “start”);



}



@Override

public void simpleUpdate(float tpf) {

}



@Override

public void simpleRender(RenderManager rm) {

//TODO: add render code

}



public void bind(Nifty nifty, Screen screen) {

this.nifty = nifty;



}



public void onStartScreen() {

}



public void onEndScreen() {

}



}[/java]



dragndrop.xml

[xml]<?xml version=“1.0” encoding=“UTF-8”?>

<nifty xmlns=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>

<useStyles filename=“nifty-default-styles.xml” />

<useControls filename=“nifty-default-controls.xml” />

<style id=“dropArea”>

<attributes padding=“10px” />

<effect>

<onActive name=“border” post=“true” color="#222f" border=“1px” />

</effect>

</style>

<style id=“descriptionText” base=“base-font”>

<attributes color="#eeef" valign=“center” width=“100%” />

</style>

<screen id=“start” defaultFocusElement=“backButton” controller=“de.lessvoid.nifty.examples.dragndrop.DragDropScreen”>

<layer id=“layer” childLayout=“center”>

<panel id=“dialog” style=“nifty-panel” childLayout=“center” padding=“18px,28px,28px,16px” width=“80%” height=“90%” align=“center” valign=“center”>

<panel childLayout=“vertical” align=“center” valign=“center”>

<panel id=“draggables” childLayout=“horizontal” height="">

<control id=“MyDroppable3” name=“droppable” style=“dropArea” width=“140px” height=“140px” align=“center” valign=“top”>

<text text=“Drop Here!” style=“descriptionText” />

</control>

<control name=“scrollPanel” style=“special-scrollpanel” width=“240px” worldMax=“360”>

<control id=“MyDraggable1” name=“draggable” backgroundColor="#f60f" width=“120px” height=“120px” childLayout=“center” valign=“top”>

<text text=“Drag Me!” style=“descriptionText” />

</control>

<control id=“MyDraggable2” name=“draggable” backgroundColor="#0f6f" width=“120px” height=“120px” childLayout=“center” valign=“top”>

<text text=“Drag Me!” style=“descriptionText” />

</control>

<control id=“MyDraggable3” name=“draggable” backgroundColor="#6f04" width=“120px” height=“120px” childLayout=“center” valign=“top”>

<text text=“Drag Me!” style=“descriptionText” />

</control>

</control>

</panel>

<panel id=“droppables” childLayout=“horizontal” height="
">

<control id=“MyDroppable2” name=“droppable” style=“dropArea” width=“140px” height=“140px”>

<text text=“Drop Here!” style=“descriptionText” />

</control>

<panel width=“10px”/>

<control id=“GoodStuff” name=“droppable” style=“dropArea” backgroundColor="#ffff" width=“140px” height=“140px”>

<text text=“No Evil Stuff” style=“descriptionText” color="#000f" />

</control>

<panel width=“10px”/>

<control id=“EvilStuff” name=“droppable” style=“dropArea” backgroundColor="#222f" width=“140px” height=“140px”>

<text text=“Evil Stuff” style=“descriptionText” />

</control>

<panel width="*"/>

<control id=“Trash” name=“droppable” style=“dropArea” width=“140px” height=“140px”>

<text text=“Discard Here!” style=“descriptionText” />

</control>

</panel>



</panel>

</panel>

</layer>



</screen>

</nifty> [/xml]

Fixed in 1.3.2 as well - see this bug report in the nifty bug tracker for details. And here is the corresponding commit at github: https://github.com/void256/nifty-gui/commit/82ae734986fe02cee5206639861cb151a44dc09b

Awesome