Skip to content

Commit

Permalink
Add ElementaVersion V7 for disabling input events when an error has o…
Browse files Browse the repository at this point in the history
…ccurred during drawing
  • Loading branch information
CallumBugajski committed Sep 18, 2024
1 parent 531a699 commit 384c66e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions api/Elementa.api
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public final class gg/essential/elementa/ElementaVersion : java/lang/Enum {
public static final field V4 Lgg/essential/elementa/ElementaVersion;
public static final field V5 Lgg/essential/elementa/ElementaVersion;
public static final field V6 Lgg/essential/elementa/ElementaVersion;
public static final field V7 Lgg/essential/elementa/ElementaVersion;
public final fun enableFor (Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public static fun valueOf (Ljava/lang/String;)Lgg/essential/elementa/ElementaVersion;
public static fun values ()[Lgg/essential/elementa/ElementaVersion;
Expand Down
8 changes: 8 additions & 0 deletions src/main/kotlin/gg/essential/elementa/ElementaVersion.kt
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,14 @@ enum class ElementaVersion {
/**
* [gg.essential.elementa.components.ScrollComponent] now has a minimum size for scrollbar grips.
*/
@Deprecated(DEPRECATION_MESSAGE)
V6,

/**
* [gg.essential.elementa.components.Window] now disables input events if an error has occurred during drawing.
*/
V7,

;

/**
Expand Down Expand Up @@ -134,7 +140,9 @@ Be sure to read through all the changes between your current version and your ne
internal val v4 = V4
@Suppress("DEPRECATION")
internal val v5 = V5
@Suppress("DEPRECATION")
internal val v6 = V6
internal val v7 = V7


@PublishedApi
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/gg/essential/elementa/components/Window.kt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class Window @JvmOverloads constructor(
}

override fun mouseScroll(delta: Double) {
if (hasErrored) {
if (hasErrored && version >= ElementaVersion.v7) {
return
}

Expand All @@ -189,7 +189,7 @@ class Window @JvmOverloads constructor(
}

override fun mouseClick(mouseX: Double, mouseY: Double, button: Int) {
if (hasErrored) {
if (hasErrored && version >= ElementaVersion.v7) {
return
}

Expand Down Expand Up @@ -238,7 +238,7 @@ class Window @JvmOverloads constructor(
}

override fun mouseRelease() {
if (hasErrored) {
if (hasErrored && version >= ElementaVersion.v7) {
return
}

Expand All @@ -250,7 +250,7 @@ class Window @JvmOverloads constructor(
}

override fun keyType(typedChar: Char, keyCode: Int) {
if (hasErrored) {
if (hasErrored && version >= ElementaVersion.v7) {
return
}

Expand Down

0 comments on commit 384c66e

Please sign in to comment.