Skip to content

Commit 5ed5e45

Browse files
committed
style(view): reformat PieceImage code
1 parent ff5a091 commit 5ed5e45

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/main/kotlin/sc/gui/view/PieceImage.kt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package sc.gui.view
22

3-
import io.github.oshai.kotlinlogging.KotlinLogging
43
import javafx.animation.Animation
54
import javafx.animation.KeyFrame
65
import javafx.beans.value.ObservableDoubleValue
@@ -15,8 +14,6 @@ import tornadofx.*
1514
import java.lang.ref.WeakReference
1615
import kotlin.random.Random
1716

18-
private val logger = KotlinLogging.logger { }
19-
2017
val animationDuration = Duration.seconds(0.1)
2118
val transitionDuration = animationDuration.multiply(8.0)
2219
val animationInterval = timeline {
@@ -46,7 +43,7 @@ class ResizableImageView(sizeProperty: ObservableValue<Number>): ImageView() {
4643
override fun isResizable(): Boolean = true
4744

4845
override fun toString(): String =
49-
"${styleClass.joinToString(".")}@${Integer.toHexString(hashCode())}${pseudoClassStates.joinToString("") { ":$it" }}"
46+
"${styleClass.joinToString(".")}@${Integer.toHexString(hashCode())}${pseudoClassStates.joinToString("") { ":$it" }}"
5047
}
5148

5249
/** Holds a potentially animated piece on a position on the board.
@@ -70,14 +67,19 @@ class PieceImage(private val sizeProperty: ObservableDoubleValue, val content: S
7067
frame = nextFrame()
7168
}
7269

73-
fun nextFrame(prefix: String = "idle", oldFrame: Int = frame, randomize: Boolean = true, remove: Boolean = false): Int {
70+
fun nextFrame(
71+
prefix: String = "idle",
72+
oldFrame: Int = frame,
73+
randomize: Boolean = true,
74+
remove: Boolean = false,
75+
): Int {
7476
val img = children.lastOrNull()
7577
img?.removePseudoClass("$prefix$oldFrame")
7678
return if(!remove)
7779
(oldFrame.inc() + if(randomize) Random.nextInt(1, 5).div(5) else 0)
78-
.mod(frameCount).also { newFrame ->
79-
img?.addPseudoClass("$prefix$newFrame")
80-
}
80+
.mod(frameCount).also { newFrame ->
81+
img?.addPseudoClass("$prefix$newFrame")
82+
}
8183
else -1
8284
}
8385

@@ -93,9 +95,9 @@ class PieceImage(private val sizeProperty: ObservableDoubleValue, val content: S
9395
}
9496

9597
override fun toString(): String =
96-
"$content@${Integer.toHexString(hashCode())}" +
97-
pseudoClassStates.joinToString("") { ":$it" } +
98-
children
98+
"$content@${Integer.toHexString(hashCode())}" +
99+
pseudoClassStates.joinToString("") { ":$it" } +
100+
children
99101

100102
}
101103

0 commit comments

Comments
 (0)