mirror of
https://github.com/sojamo/controlp5
synced 2025-02-22 15:52:51 +01:00
events are sent only to active controller
This commit is contained in:
parent
8f79b27cb1
commit
b4d6768f73
14
.idea/aws.xml
generated
Normal file
14
.idea/aws.xml
generated
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="accountSettings">
|
||||||
|
<option name="activeRegion" value="us-east-1" />
|
||||||
|
<option name="recentlyUsedRegions">
|
||||||
|
<list>
|
||||||
|
<option value="us-east-1" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="connectionManager">
|
||||||
|
<option name="activeConnectionId" value="sso;us-east-1;https://view.awsapps.com/start" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1197,6 +1197,7 @@ public abstract class Controller< T > implements ControllerInterface< T > , CDra
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void mousePressed( ) {
|
protected void mousePressed( ) {
|
||||||
|
( (ControllerGroup<?>) _myParent).setActiveController(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void mouseReleased( ) {
|
protected void mouseReleased( ) {
|
||||||
|
@ -23,7 +23,7 @@ package controlP5;
|
|||||||
* @modified ##date##
|
* @modified ##date##
|
||||||
* @version ##version##
|
* @version ##version##
|
||||||
*
|
*
|
||||||
*/
|
**/
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -43,6 +43,9 @@ public abstract class ControllerGroup< T > implements ControllerInterface< T > ,
|
|||||||
protected float[] positionBuffer = new float[ 2 ];
|
protected float[] positionBuffer = new float[ 2 ];
|
||||||
protected float[] absolutePosition = new float[ 2 ];
|
protected float[] absolutePosition = new float[ 2 ];
|
||||||
protected ControllerList controllers;
|
protected ControllerList controllers;
|
||||||
|
|
||||||
|
/* the controller that receives KeyEvents*/
|
||||||
|
protected Controller<?> activeController;
|
||||||
protected List< ControlListener > _myControlListener;
|
protected List< ControlListener > _myControlListener;
|
||||||
// protected ControlWindow _myControlWindow;
|
// protected ControlWindow _myControlWindow;
|
||||||
protected ControlP5 cp5;
|
protected ControlP5 cp5;
|
||||||
@ -540,11 +543,25 @@ public abstract class ControllerGroup< T > implements ControllerInterface< T > ,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ControlP5.Invisible public void keyEvent( KeyEvent theEvent ) {
|
@ControlP5.Invisible public void keyEvent( KeyEvent theEvent ) {
|
||||||
for ( int i = 0 ; i < controllers.size( ) ; i++ ) {
|
//for ( int i = 0 ; i < controllers.size( ) ; i++ ) {
|
||||||
( ( ControllerInterface< ? > ) controllers.get( i ) ).keyEvent( theEvent );
|
// ( ( ControllerInterface< ? > ) controllers.get( i ) ).keyEvent( theEvent );
|
||||||
|
//}
|
||||||
|
if ( activeController != null ){
|
||||||
|
activeController.keyEvent(theEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ControllerGroup<T> setActiveController(Controller<?> theController){
|
||||||
|
activeController = theController;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Controller<?> getActiveController(){
|
||||||
|
return activeController;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean setMousePressed( boolean theStatus ) {
|
public boolean setMousePressed( boolean theStatus ) {
|
||||||
if ( !isVisible ) {
|
if ( !isVisible ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -260,6 +260,8 @@ public class Textfield extends Controller< Textfield > implements ReleasedOutsid
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void mousePressed( ) {
|
@Override protected void mousePressed( ) {
|
||||||
|
super.mousePressed();
|
||||||
|
|
||||||
if ( isActive ) {
|
if ( isActive ) {
|
||||||
// TODO System.out.println("adjust cursor");
|
// TODO System.out.println("adjust cursor");
|
||||||
}
|
}
|
||||||
@ -268,6 +270,8 @@ public class Textfield extends Controller< Textfield > implements ReleasedOutsid
|
|||||||
|
|
||||||
// TODO System.out.println(x + ":" + y);
|
// TODO System.out.println(x + ":" + y);
|
||||||
setFocus( true );
|
setFocus( true );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void mouseReleasedOutside( ) {
|
@Override public void mouseReleasedOutside( ) {
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user