package net.hareworks.ghostdisplays.api import kotlin.math.max /** * 設置されたDisplay上にクリック判定用のInteractionエンティティを重ねる際のオプション。 */ data class InteractionOptions( val enabled: Boolean = false, val width: Double = 0.8, val height: Double = 0.8, val responsive: Boolean = true ) { init { require(width > 0.0) { "width must be positive" } require(height > 0.0) { "height must be positive" } } fun effectiveWidth(): Double = max(width, 0.1) fun effectiveHeight(): Double = max(height, 0.1) companion object { val Disabled = InteractionOptions() fun enabled(width: Double = 0.8, height: Double = 0.8, responsive: Boolean = true): InteractionOptions = InteractionOptions(true, width, height, responsive) } }