Skip to content

Commit

Permalink
Killing passes earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
ewoudje committed Feb 26, 2024
1 parent cd22121 commit 0e5ba27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/commonMain/kotlin/com/ewoudje/eggui/EGGPass.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.ewoudje.eggui

interface EGGPass
interface EGGPass {
fun shouldStop(pos: Pos): Boolean = false
}
interface EGGInitPass: EGGPass

data class RenderPass(private val renderer: EGGRenderer) : EGGPass, EGGRenderer by renderer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ private fun traverse(comp: EGGComponent, ctx: EGGContext, trace: Trace) {
}

trace.enter(comp)
comp.children.forEach { traverse(it, newCtx, trace) }
comp.children.forEach {
if (ctx.pass.shouldStop(newCtx.getPosition(it.childId))) return@forEach

traverse(it, newCtx, trace)
}

try {
comp.exit(newCtx)
Expand Down

0 comments on commit 0e5ba27

Please sign in to comment.