Skip to content

Commit 83156d8

Browse files
Fixed issue with the switch button in the Server Options for switching between using a local and remote server.
1 parent b807d42 commit 83156d8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

VERSIONS.MD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ A new sample bot, PaintingBot, has been introduced to showcase the use of debug
4747

4848
- Server:
4949
- Log messages printed out `{}` instead of content.
50+
- UI:
51+
- Fixed issue with the switch button in the Server Options for switching between using a local and remote server.
5052

5153
## 📦 0.29.0 - All about colors - 19-Jan-2024
5254

gui-app/src/main/kotlin/dev/robocode/tankroyale/gui/ui/components/SwitchButton.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import javax.swing.Timer
1515
class SwitchButton(initialSelected: Boolean) : JComponent() {
1616

1717
private var knobLocation: Float = 2f
18-
private val animationSpeed: Float = 0.05f
1918
private val animationTimer = createAnimationTimer()
2019

2120
var isSelected = initialSelected
@@ -49,19 +48,19 @@ class SwitchButton(initialSelected: Boolean) : JComponent() {
4948
})
5049
}
5150

52-
private fun createAnimationTimer(): Timer = Timer(0) { _ ->
51+
private fun createAnimationTimer(): Timer = Timer(1000 / 60) { _ ->
5352
if (isSelected) {
5453
val endLocation = width - height + 2f
5554
if (knobLocation < endLocation) {
56-
knobLocation += animationSpeed
55+
knobLocation += 4f
5756
} else {
5857
animationTimer.stop()
5958
knobLocation = endLocation
6059
}
6160
} else {
6261
val endLocation = 2f
6362
if (knobLocation > endLocation) {
64-
knobLocation -= animationSpeed
63+
knobLocation -= 4f
6564
} else {
6665
animationTimer.stop()
6766
knobLocation = endLocation

0 commit comments

Comments
 (0)