Commit 42daee41 authored by Nico Mack's avatar Nico Mack

Added code for triggering drag interactions

parent af0d6764
......@@ -15,6 +15,7 @@ package lu.list.itis.dkd.tui.widget.corona;
import lu.list.itis.dkd.tui.content.InformationProvider;
import lu.list.itis.dkd.tui.cps.variable.NumericalVariable;
import lu.list.itis.dkd.tui.event.interaction.Interaction;
import lu.list.itis.dkd.tui.feature.touch.TouchEvent;
import lu.list.itis.dkd.tui.feature.touch.TouchManager;
import lu.list.itis.dkd.tui.utility.AngleUtils;
......@@ -482,6 +483,11 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
this.setSelected(!this.isSelected);
}
}
if (touched) {
this.respondTo(Interaction.ON_TOUCHED);
}
return touched;
}
......@@ -490,10 +496,15 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
@Override
public boolean dragged(TouchEvent event) {
boolean wasDragged = false;
boolean wasDraggingBefore = touchManager.wasDragging(event);
if (isTouchable()) {
wasDragged = touchManager.drag(event);
if (wasDragged) {
if (!wasDraggingBefore) {
this.respondTo(Interaction.ON_DRAG_BEGIN);
}
if (!this.isSelected)
this.setSelected(true);
this.updateFromTouchEvent(event);
......@@ -506,10 +517,19 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
@Override
public boolean released(TouchEvent event) {
boolean released = false;
boolean wasDraggingBefore = touchManager.wasDragging(event);
if (isTouchable()) {
released = touchManager.release(event);
}
if (released) {
if (wasDraggingBefore) {
this.respondTo(Interaction.ON_DRAG_END);
}
this.respondTo(Interaction.ON_RELEASED);
}
return released;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment