Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/controlP5/ControlFont.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ public void draw( PGraphics theGraphics , Label theLabel ) {
theGraphics.textFont( pfont , size );
theGraphics.textAlign( theLabel.textAlign );
theGraphics.fill( theLabel.getColor( ) );

if ( theLabel.isMultiline( ) ) {
theGraphics.fill( theLabel.getColor( ) );
theGraphics.textLeading( theLabel.getLineHeight( ) );
Expand Down
2 changes: 1 addition & 1 deletion src/controlP5/ControlWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ public ControlWindow setUndecorated( boolean theFlag ) {
_myApplet.frame.removeNotify( );
_myApplet.frame.setUndecorated( isUndecorated );
_myApplet.setSize( _myApplet.width , _myApplet.height );
_myApplet.setBounds( 0 , 0 , _myApplet.width , _myApplet.height );
//_myApplet.setBounds( 0 , 0 , _myApplet.width , _myApplet.height );
_myApplet.frame.setSize( _myApplet.width , _myApplet.height );
_myApplet.frame.addNotify( );
}
Expand Down
44 changes: 40 additions & 4 deletions src/controlP5/Slider.java
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ void updateInternalEvents( PApplet theApplet ) {
}

public void display( PGraphics theGraphics , Slider theController ) {
//theGraphics.clear();
theGraphics.fill( getColor( ).getBackground( ) );
theGraphics.noStroke( );
if ( ( getColor( ).getBackground( ) >> 24 & 0xff ) > 0 ) {
Expand Down Expand Up @@ -552,11 +553,26 @@ public void display( PGraphics theGraphics , Slider theController ) {
theGraphics.pushStyle( );
theGraphics.translate( -4 , ( getSliderMode( ) == FIX ) ? 0 : getHandleSize( ) / 2 );
theGraphics.fill( _myColorTickMark );
float x = ( getHeight( ) - ( ( getSliderMode( ) == FIX ) ? 0 : getHandleSize( ) ) ) / ( getTickMarks( ).size( ) - 1 );
float x = ( (float)getHeight( ) - ( ( getSliderMode( ) == FIX ) ? 0 : getHandleSize( ) ) ) / ( getTickMarks( ).size( ) - 1 );
int tickMarksCount = 0;
int totalTickMarks = _myTickMarks.size();
int xOffset;
for ( TickMark tm : getTickMarks( ) ) {
theGraphics.pushMatrix();
xOffset = PApplet.round(x*tickMarksCount);

if(tickMarksCount < totalTickMarks -1){
theGraphics.translate( 0, xOffset );
}else{
theGraphics.translate( 0, xOffset-1 );
}

tm.draw( theGraphics , getDirection( ) );
theGraphics.translate( 0 , x );
theGraphics.popMatrix();
//PApplet.println(tickMarksCount + " > xOffset: " + xOffset);
tickMarksCount++;
}

theGraphics.popStyle( );
theGraphics.popMatrix( );
}
Expand Down Expand Up @@ -614,18 +630,38 @@ public void display( PGraphics theGraphics , Slider theController ) {
}

if ( isShowTickMarks ) {

theGraphics.pushMatrix( );
// theGraphics.pushStyle( );
theGraphics.translate( ( getSliderMode( ) == FIX ) ? 0 : getHandleSize( ) / 2 , getHeight( ) );
theGraphics.fill( _myColorTickMark );
theGraphics.noStroke( );
float x = ( getWidth( ) - ( ( getSliderMode( ) == FIX ) ? 0 : getHandleSize( ) ) ) / ( getTickMarks( ).size( ) - 1 );

float x = ( (float)getWidth() - ( ( getSliderMode() == FIX ) ? 0 : getHandleSize() ) ) / ( getTickMarks().size() - 1 );

int tickMarksCount = 0;
int totalTickMarks = _myTickMarks.size();
int xOffset;


for ( TickMark tm : getTickMarks( ) ) {
theGraphics.pushMatrix();
xOffset = PApplet.round(x*tickMarksCount);

if(tickMarksCount < totalTickMarks -1){
theGraphics.translate( xOffset , 0 );
}else{
theGraphics.translate( xOffset-1 , 0 );
}

tm.draw( theGraphics , getDirection( ) );
theGraphics.translate( x , 0 );
theGraphics.popMatrix();
//PApplet.println(tickMarksCount + " > xOffset: " + xOffset);
tickMarksCount++;
}
// theGraphics.popStyle( );
theGraphics.popMatrix( );

}
}
}
Expand Down
15 changes: 11 additions & 4 deletions src/controlP5/TickMark.java
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* Boston, MA 02111-1307 USA
*
* @author Andreas Schlegel (http://www.sojamo.de)
* @modified ##date##
* @version ##version##
* @modified 03/15/2018
* @version 2.2.6
*
*/
import processing.core.PApplet;
Expand All @@ -35,6 +35,7 @@ public class TickMark implements CDrawable {
protected Controller< ? > _myParent;

protected int _myLen = 4;
protected int _myDistance = _myLen;

protected Label _myLabel;

Expand All @@ -52,16 +53,17 @@ public void draw( PGraphics theGraphics , int theDirection ) {
theGraphics.pushMatrix( );
switch ( theDirection ) {
case ( ControlP5Constants.HORIZONTAL ):
theGraphics.translate( 0 , _myLen );
theGraphics.translate( 0 , _myDistance );
theGraphics.rect( 0 , 0 , 1 , _myLen );
if ( isLabel ) {
_myLabel.draw( theGraphics , 0 , _myLen + 4 , _myParent );
}
break;
case ( ControlP5Constants.VERTICAL ):
theGraphics.translate( -_myLen , 0 );
theGraphics.translate( -_myDistance - _myLen , 0 );
theGraphics.rect( 0 , 0 , _myLen , 1 );
if ( isLabel ) {

_myLabel.draw( theGraphics , -_myLabel.getWidth( ) , 0 , _myParent );
}
break;
Expand All @@ -74,7 +76,12 @@ public void setLength( int theLength ) {
_myLen = theLength;
}

public void setDistance( int theDistance) {
_myDistance = theDistance;
}

public Label setLabel( String theLabeltext ) {

if ( _myLabel == null ) {
_myLabel = new Label( _myParent.cp5 , theLabeltext );
isLabel = true;
Expand Down