DragAndDrop inside scrollpane broke?

Anything libgdx related goes here!

DragAndDrop inside scrollpane broke?

Postby bagpipes100 » Tue Sep 16, 2014 8:05 pm

I took the DragAndDrop test from the libGDX tests and got it to work. I then put the source inside a table, and the table inside a scrollpane. Now it's broke. The source inside just a table works, but not the source in a table in a scrollpane. Anythoughts on how to make this work? I have an inventory screen which is too big to fit w/o a scroll pane.

Code: Select all
stage = new Stage();
      Gdx.input.setInputProcessor(stage);

      //final Skin skin = new Skin();
      //skin.add("default", new LabelStyle(new BitmapFont(), Color.WHITE));
      
      skin = new Skin(Gdx.files.internal("data/uiskin.json"));
      skin.add("badlogic", new Texture("data/badlogic.jpg"));
      Table table=new Table();
      ScrollPane pane=new ScrollPane(table);
      pane.setScrollingDisabled(false, false);
      Image sourceImage = new Image(skin, "badlogic");
      sourceImage.setBounds(50, 125, 100, 100);
      stage.addActor(pane);
      //stage.addActor(sourceImage);
bagpipes100
 
Posts: 73
Joined: Fri Dec 21, 2012 9:00 pm

Re: DragAndDrop inside scrollpane broke?

Postby evilentity » Wed Sep 17, 2014 8:05 am

The most likely reason is that scrollpane eats the events. One way of fixing this is to add this InputListener to your draganddrop actors.
Code: Select all
InputListener stopTouchDown = new InputListener() {
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
            event.stop();
            return false;
        }
    };
Looking for a freelancer? PM me!
Check out libgdx discord server!
evilentity
 
Posts: 4867
Joined: Wed Aug 24, 2011 11:37 am

Re: DragAndDrop inside scrollpane broke?

Postby noone » Wed Sep 17, 2014 9:24 am

https://github.com/libgdx/libgdx/pull/2240

Are you using the latest snapshot?
noone
 
Posts: 122
Joined: Sat Apr 06, 2013 6:53 pm
Location: Germany

Re: DragAndDrop inside scrollpane broke?

Postby bagpipes100 » Wed Sep 17, 2014 12:23 pm

I would just download the nightly from here http://libgdx.badlogicgames.com/nightlies/ and replace it in my project folder?
bagpipes100
 
Posts: 73
Joined: Fri Dec 21, 2012 9:00 pm

Re: DragAndDrop inside scrollpane broke?

Postby noone » Wed Sep 17, 2014 2:53 pm

Are you still using the non-gradle build?
noone
 
Posts: 122
Joined: Sat Apr 06, 2013 6:53 pm
Location: Germany

Re: DragAndDrop inside scrollpane broke?

Postby bagpipes100 » Wed Sep 17, 2014 3:34 pm

Yes. I've had difficulty getting gradle to install in eclipse. So I'm still using a non-gradle build.

I swapped out all the referenced jars and then when through and updated all the changed methods and stuff. It seems to be working now. :)
bagpipes100
 
Posts: 73
Joined: Fri Dec 21, 2012 9:00 pm

Re: DragAndDrop inside scrollpane broke?

Postby bagpipes100 » Wed Sep 17, 2014 6:52 pm

I'd call the original issue solved.

Though now, Could I get some help as to what position the payload is drawn relative to the cursor?
bagpipes100
 
Posts: 73
Joined: Fri Dec 21, 2012 9:00 pm


Return to Libgdx

Who is online

Users browsing this forum: Google [Bot], MSN [Bot] and 1 guest