Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/kmcaster.git
src/main/com/whitemagicsoftware/kmcaster/EventHandler.java
}
else {
- final var component = getHardwareComponent( state );
- final var keyValue = state.getValue();
-
- final var sup = getLabel( LabelConfig.LABEL_REGULAR_NUM_SUPERSCRIPT );
+ // Hide any previously displayed labels.
final var main = getLabel( LabelConfig.LABEL_REGULAR_NUM_MAIN );
+ final var sup = getLabel( LabelConfig.LABEL_REGULAR_NUM_SUPERSCRIPT );
main.setVisible( false );
sup.setVisible( false );
- // A non-modifier key has been pressed.
if( hwState == SWITCH_PRESSED ) {
+ final var keyValue = state.getValue();
+
// Determine whether there are separate parts for the key label.
final var index = keyValue.indexOf( ' ' );
+ final var component = getHardwareComponent( state );
final var bounds = BoundsCalculator.getBounds( component );
final var compDimen = new ScalableDimension( bounds );
// If there's a space in the name, the text before the space is
// positioned in the upper-left while the text afterwards takes up
// the remainder. This is used for number pad keys, backspace, enter,
// tab, and a few others.
if( index > 0 ) {
- final var supSize = compDimen.scale( .6f );
- final var mainSize = compDimen.scale( .9f );
-
// Label for "Num", "Back", "Tab", and other dual-labelled keys.
sup.setText( keyValue.substring( 0, index ) );
- sup.transform( supSize );
+ sup.transform( compDimen.scale( .6f ) );
// Label for number pad keys or icon glyphs.
main.setText( keyValue.substring( index + 1 ) );
- main.transform( mainSize );
+ main.transform( compDimen.scale( .9f ) );
// Shift the main label down away from the superscript.
// Track the consecutive key presses for this value.
if( mKeyCounter.apply( keyValue ) ) {
- final var count = mKeyCounter.toString();
final var tally = getLabel( LabelConfig.LABEL_REGULAR_COUNTER );
- final var tallySize = compDimen.scale( .25f );
- tally.setText( count );
- tally.transform( tallySize );
+ tally.setText( mKeyCounter.toString() );
+ tally.transform( compDimen.scale( .25f ) );
tally.setVisible( true );
}

Remove superfluous variables

Author DaveJarvis <email>
Date 2020-07-29 14:02:16 GMT-0700
Commit 5020a299da683d5652ef22bf195cda43b203b20e
Parent c58f393
Delta 9 lines added, 14 lines removed, 5-line decrease