Precise color setting on color wang using mouse scroll wheel
This commit is contained in:
parent
b208ca1358
commit
57e42fef33
@ -25,6 +25,7 @@ import ru.dbotthepony.mc.otm.core.ResourceLocation
|
||||
import java.util.function.Consumer
|
||||
import java.util.function.Supplier
|
||||
import kotlin.math.roundToInt
|
||||
import kotlin.math.sign
|
||||
|
||||
open class ColorBoxPanel<out S : Screen>(
|
||||
screen: S,
|
||||
@ -203,6 +204,11 @@ abstract class AbstractColorWangPanel<out S : Screen>(
|
||||
return super.mouseReleasedInner(x, y, button)
|
||||
}
|
||||
|
||||
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||
onWangInput((wangPosition + sign(scroll.toFloat()) * (1f / 255f)).coerceIn(0f, 1f))
|
||||
return true
|
||||
}
|
||||
|
||||
protected fun renderGradients(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||
ColorBoxPanel.GRADIENT_RIGHT.render(graphics, 0f, 0f, width, height, color = rightColor)
|
||||
ColorBoxPanel.GRADIENT_LEFT.render(graphics, 0f, 0f, width, height, color = leftColor)
|
||||
|
Loading…
Reference in New Issue
Block a user