@Override
public boolean processInputEvent(MTInputEvent inEvt) {
//We have to retarget inputevents for this component to the windowed scene
if (inEvt instanceof AbstractCursorInputEvt){
AbstractCursorInputEvt posEvt = (AbstractCursorInputEvt)inEvt;
float x = posEvt.getPosX();
float y = posEvt.getPosY();
float newX = 0;
float newY = 0;
//Check intersection with infinite plane, this rect lies in
Vector3D interSP = p.getIntersectionLocal(this.globalToLocal(Tools3D.getCameraPickRay(app, this, x, y)));
if (interSP != null){
//System.out.println(interSP);
newX = interSP.x;
newY = interSP.y;
}
AbstractCursorInputEvt newEvt = null;
switch (posEvt.getId())
{
case AbstractCursorInputEvt.INPUT_DETECTED:{
InputCursor newCursor = new InputCursor();
try {
newEvt = (AbstractCursorInputEvt) posEvt.clone();
newEvt.setPositionX(newX);
newEvt.setPositionY(newY);
// newCursor.addEvent(newEvt);
newEvt.setCursor(newCursor);
newEvt.preFire();
//Note: We dont set a target for the event! this can be
//handled newly in the wondowed scenes InputRetargeter processor
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
this.oldCursorToNewCursor.put(posEvt.getCursor(), newCursor);
//TODO checken ob cursor bereits events enth�lt - �berhaupt m�glich?..
//ELSE -> CLONE AND ADD ALL OLD EVENTS TO THE NEW CURSOR!
}break;
case AbstractCursorInputEvt.INPUT_UPDATED:{
InputCursor newCursor = this.oldCursorToNewCursor.get(posEvt.getCursor());
if (newCursor != null){
try {
newEvt = (AbstractCursorInputEvt) posEvt.clone();
newEvt.setPositionX(newX);
newEvt.setPositionY(newY);
// newCursor.addEvent(newEvt);
newEvt.setCursor(newCursor);
newEvt.preFire();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
}else{
System.err.println("Couldnt find new cursor!");
}
}break;
case AbstractCursorInputEvt.INPUT_ENDED:{
InputCursor newCursor = this.oldCursorToNewCursor.remove(posEvt.getCursor());
if (newCursor != null){
try {
newEvt = (AbstractCursorInputEvt) posEvt.clone();
newEvt.setPositionX(newX);
newEvt.setPositionY(newY);
// newCursor.addEvent(newEvt);
newEvt.setCursor(newCursor);
newEvt.preFire();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
}else{
System.err.println("Couldnt find new cursor!");
}
}break;
default:
break;
}
AbstractCursorInputEvt evtToFire = (newEvt != null) ?
newEvt :
posEvt;
//Send similar event to the windowed scenes global input processors
AbstractGlobalInputProcessor[] globalAnalyzer = app.getInputManager().getGlobalInputProcessors(scene);