Add invertY to annotation, remove keyboardIncrement, rename showAngle to showVector, reorder min-max arguments
This commit is contained in:
@@ -82,12 +82,12 @@ annotation class ColorParameter(val label: String, val order: Int = Integer.MAX_
|
||||
annotation class XYParameter(
|
||||
val label: String,
|
||||
val minX: Double = -1.0,
|
||||
val minY: Double = -1.0,
|
||||
val maxX: Double = 1.0,
|
||||
val minY: Double = -1.0,
|
||||
val maxY: Double = 1.0,
|
||||
val precision: Int = 1,
|
||||
val keyboardIncrement: Double = 10.0,
|
||||
val showAngle: Boolean = false,
|
||||
val showVector: Boolean = false,
|
||||
val invertY: Boolean = true,
|
||||
val order: Int = Integer.MAX_VALUE
|
||||
)
|
||||
|
||||
@@ -130,7 +130,7 @@ enum class ParameterType(val annotationClass: KClass<out Annotation>) {
|
||||
* @property doubleRange a floating point based range in case [DoubleParameter] is used
|
||||
* @property intRange an integer range in case [IntParameter] is used
|
||||
* @property precision a precision hint in case a [DoubleParameter] annotation is used
|
||||
* @property keyboardIncrement how much change the keyboard makes in case a [XYParameter] annotation is used
|
||||
* @property invertY should the y-axis of [XYParameter] be inverted?
|
||||
* @property order a hint for where in the ui this parameter is placed, lower value means higher priority
|
||||
*/
|
||||
class Parameter(
|
||||
@@ -142,8 +142,8 @@ class Parameter(
|
||||
val vectorRange: Pair<Vector2, Vector2>?,
|
||||
val intRange: IntRange?,
|
||||
val precision: Int?,
|
||||
val keyboardIncrement: Double?,
|
||||
val showAngle: Boolean?,
|
||||
val invertY: Boolean?,
|
||||
val showVector: Boolean?,
|
||||
val order: Int)
|
||||
|
||||
/**
|
||||
@@ -164,8 +164,8 @@ fun Any.listParameters(): List<Parameter> {
|
||||
var precision: Int? = null
|
||||
var type: ParameterType? = null
|
||||
var vectorRange = Pair(Vector2(-1.0, -1.0), Vector2(1.0, 1.0))
|
||||
var keyboardIncrement: Double? = null
|
||||
var showAngle: Boolean? = null
|
||||
var invertY: Boolean? = null
|
||||
var showVector: Boolean? = null
|
||||
|
||||
annotations.forEach {
|
||||
type = ParameterType.forParameterAnnotationClass(it)
|
||||
@@ -197,9 +197,9 @@ fun Any.listParameters(): List<Parameter> {
|
||||
label = it.label
|
||||
order = it.order
|
||||
vectorRange = Pair(Vector2(it.minX, it.minY), Vector2(it.maxX, it.maxY))
|
||||
keyboardIncrement = it.keyboardIncrement
|
||||
precision = it.precision
|
||||
showAngle = it.showAngle
|
||||
invertY = it.invertY
|
||||
showVector = it.showVector
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,8 +212,8 @@ fun Any.listParameters(): List<Parameter> {
|
||||
vectorRange = vectorRange,
|
||||
intRange = intRange,
|
||||
precision = precision,
|
||||
keyboardIncrement = keyboardIncrement,
|
||||
showAngle = showAngle,
|
||||
showVector = showVector,
|
||||
invertY = invertY,
|
||||
order = order
|
||||
)
|
||||
} + this::class.declaredMemberFunctions.filter {
|
||||
@@ -232,8 +232,8 @@ fun Any.listParameters(): List<Parameter> {
|
||||
intRange = null,
|
||||
vectorRange = null,
|
||||
precision = null,
|
||||
keyboardIncrement = null,
|
||||
showAngle = false,
|
||||
showVector = null,
|
||||
invertY = null,
|
||||
order = order
|
||||
)
|
||||
}).sortedBy { it.order }
|
||||
|
||||
Reference in New Issue
Block a user