mirror of
https://github.com/sojamo/controlp5
synced 2024-11-16 03:07:56 +01:00
mouseReleasedOutside available for more controllers that needs it (other than TextField)
This commit is contained in:
parent
5d71157755
commit
8f79b27cb1
@ -1,5 +1,8 @@
|
||||
## this is a fork of the original controlP5 library by Andreas Schlegel
|
||||
## it provides a pom.xml for maven and can be used as a dependency in maven projects
|
||||
## My changes include:
|
||||
- it provides a pom.xml for maven and can be used as a dependency in maven projects
|
||||
- Tweeks in the getting focus/losing focus for custom controllers that extends the Controller class (See ReleasedOutsideListener.java Interface)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -31,6 +31,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import controlP5.events.ReleasedOutsideListener;
|
||||
import processing.core.PApplet;
|
||||
import processing.core.PFont;
|
||||
import processing.core.PGraphics;
|
||||
@ -583,7 +584,7 @@ public abstract class Controller< T > implements ControllerInterface< T > , CDra
|
||||
return false;
|
||||
}
|
||||
if ( theStatus == true ) {
|
||||
if ( isInside ) {
|
||||
if ( inside() ) {
|
||||
isMousePressed = true;
|
||||
if ( !cp5.isAltDown( ) ) {
|
||||
mousePressed( );
|
||||
@ -629,7 +630,7 @@ public abstract class Controller< T > implements ControllerInterface< T > , CDra
|
||||
cp5.getControlBroadcaster( ).invokeAction( new CallbackEvent( this , ACTION_RELEASE_OUTSIDE ) );
|
||||
callListener( ACTION_RELEASE_OUTSIDE );
|
||||
}
|
||||
if ( this instanceof Textfield ) {
|
||||
if ( this instanceof ReleasedOutsideListener) {
|
||||
mouseReleasedOutside( );
|
||||
onReleaseOutside( );
|
||||
callListener( ACTION_RELEASE_OUTSIDE );
|
||||
@ -1216,7 +1217,7 @@ public abstract class Controller< T > implements ControllerInterface< T > , CDra
|
||||
*
|
||||
* @param KeyEvent theEvent
|
||||
*/
|
||||
@ControlP5.Invisible public void keyEvent( final KeyEvent theEvent ) {
|
||||
public void keyEvent( final KeyEvent theEvent ) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,6 +31,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import controlP5.events.ReleasedOutsideListener;
|
||||
import processing.core.PApplet;
|
||||
import processing.core.PFont;
|
||||
import processing.core.PGraphics;
|
||||
@ -48,7 +49,7 @@ import processing.event.KeyEvent;
|
||||
* @example controllers/ControlP5textfield
|
||||
* @nosuperclasses Controller Controller
|
||||
*/
|
||||
public class Textfield extends Controller< Textfield > {
|
||||
public class Textfield extends Controller< Textfield > implements ReleasedOutsideListener {
|
||||
|
||||
/* TODO textspacing does not work properly for bitfonts sometimes first row of pixels in a
|
||||
* bitfont texture gets cut off */
|
||||
@ -269,7 +270,7 @@ public class Textfield extends Controller< Textfield > {
|
||||
setFocus( true );
|
||||
}
|
||||
|
||||
@Override protected void mouseReleasedOutside( ) {
|
||||
@Override public void mouseReleasedOutside( ) {
|
||||
if ( isKeepFocus == false ) {
|
||||
isTexfieldActive = isActive = false;
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
package controlP5.events;
|
||||
|
||||
public interface ReleasedOutsideListener {
|
||||
public void mouseReleasedOutside( ) ;
|
||||
|
||||
}
|
@ -1,9 +1,6 @@
|
||||
package sketch;
|
||||
|
||||
import controlP5.ControlEvent;
|
||||
import controlP5.ControlP5;
|
||||
import controlP5.RadioButton;
|
||||
import controlP5.TextfieldMultiline;
|
||||
import controlP5.*;
|
||||
import processing.core.PApplet;
|
||||
|
||||
public class Sketch extends PApplet {
|
||||
@ -20,21 +17,8 @@ public class Sketch extends PApplet {
|
||||
public void setup(){
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
RadioButton b = new RadioButton(cp5,"radioButton")
|
||||
.setPosition(100,100)
|
||||
.setSize(40,20)
|
||||
.setColorForeground(color(120))
|
||||
.setColorActive(color(255))
|
||||
.setColorLabel(color(255))
|
||||
.setItemsPerRow(3)
|
||||
.setSpacingColumn(50)
|
||||
.addItem("foo",1)
|
||||
.addItem("bar",2)
|
||||
.addItem("baz",3)
|
||||
.activate(0)
|
||||
;
|
||||
|
||||
b.plugTo(this,"radioButton");
|
||||
Button b = new Button(cp5,"").setSize(100,100);
|
||||
MultilineTextfield ml = new MultilineTextfield(cp5,"mlt");
|
||||
|
||||
|
||||
}
|
||||
|
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.
BIN
target/classes/controlP5/events/ReleasedOutsideListener.class
Normal file
BIN
target/classes/controlP5/events/ReleasedOutsideListener.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -117,7 +117,6 @@ controlP5/ColorWheel$1.class
|
||||
controlP5/FieldChangedListener$1.class
|
||||
controlP5/Slider2D$Slider2DView.class
|
||||
controlP5/TextfieldMultiline$MoveLeft.class
|
||||
controlP5/layout/LayoutBuilder.class
|
||||
controlP5/ControlBroadcaster$EmptyController.class
|
||||
controlP5/Chart$ChartViewLine.class
|
||||
controlP5/Icon$IconImageView.class
|
||||
|
@ -18,6 +18,7 @@
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControllerProperty.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ColorPicker.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Tooltip.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/events/ReleasedOutsideListener.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Group.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/CP.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Tab.java
|
||||
@ -37,7 +38,6 @@
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlKey.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlP5Base.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Slider.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/layout/LayoutBuilder.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/MultiList.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControllerGroup.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Textfield.java
|
||||
@ -74,6 +74,7 @@
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControllerView.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlWindowCanvas.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlTimer.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/MultilineTextfield.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlWindow.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlBroadcaster.java
|
||||
/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Pointer.java
|
||||
|
Loading…
Reference in New Issue
Block a user