Use the xor operator in ButtonImpl.kt, and use "&&" instead of the "and" method in ClickGui.kt

This commit is contained in:
Username404 2021-06-19 18:42:58 +02:00
parent fd4a380acb
commit 8e0848a497
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ object ClickGui: SnowyScreen() {
override fun mouseDragged(d: Double, e: Double, i: Int, f: Double, g: Double): Boolean {
if (i == 0) {
components.forEach {
if (it.isWithinBounds(d, e) and !GuiDragging) {
if (it.isWithinBounds(d, e) && !GuiDragging) {
GuiDragging = true
it.x = d.minus(f) + (d - (it.x + it.width))
it.y = e.minus(g) + (e - (it.y + it.height))

View File

@ -68,7 +68,7 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
private var wasWithinBounds: Boolean = false
var toggled: Boolean = false; private set(value) {
if (value) lightUp() else if (field) lightDown()
if ((!(!field && !value))) {
if (field xor value) {
field = value
execAction()
} else field = value