1
私はすべてのセルに別のテーブルを含むテーブルを持っています。例えば、そのテーブルは8つの他のテーブルを持つことができます。私は小さなテーブルをドラッグすることができるようにドラッグアンドドロップを追加しました。それは部分的にしか機能しません。小さいテーブルの下をタッチすると、ドラッグアンドドロップのみが検出されます。それらの真ん中または上をタッチするとトリガしません。小さなテーブルの幅と高さを設定しようとしましたが、ドラッグ&ドロップも上のポイントからトリガーされますが、どこからでもそうではありませんか?何が間違っていますか?アクタの下からトリガだけをドラッグアンドドロップするLibgdx
マイコード: コードでは、collectionTableがより大きなテーブルであり、TestCardがcollectionTableに追加される小さなテーブルのタイプです。
dnd = new DragAndDrop();
dnd.setDragTime(50);
for (final Actor x : collectionTable.getChildren()) {
TestCard y = (TestCard) x;
y.setWidth(Gdx.graphics.getWidth()/(7 * scale));
y.setHeight(Gdx.graphics.getHeight()/(3.3f * scale));
dnd.addSource(new CardSource(y));
dnd.addTarget(new Target(selectedDeck);
//not adding the code from the target as it works as intended
class CardSource extends Source {
final Payload payload = new Payload();
TestCard card;
public CardSource(Actor actor) {
super(actor);
}
public CardSource(TestCard card) {
super(card);
this.card = card;
card.setWidth(Gdx.graphics.getWidth()/(7 * scale));
card.setHeight(Gdx.graphics.getHeight()/(3.3f * scale));
}
public Payload dragStart(InputEvent event, float x, float y, int pointer) {
payload.setObject(card.);
payload.setDragActor(new TestCard(card));
//payload.setInvalidDragActor(invalidActor);
payload.setValidDragActor(new TestCard(card));
return payload;
}
}