Fix scheme rectangle bug
This commit is contained in:
parent
b68fa02fa4
commit
c82f47a786
@ -11,6 +11,7 @@ import center.sciprog.maps.scheme.*
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.math.PI
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
@ -31,6 +32,7 @@ fun App() {
|
||||
text(410.52737 to 868.7676, "Shire", color = Color.Blue)
|
||||
circle(1132.0881 to 394.99127, color = Color.Red)
|
||||
text(1132.0881 to 394.99127, "Ordruin", color = Color.Red)
|
||||
arc(center = 1132.0881 to 394.99127, radius = 10f, startAngle = 0f, 2 * PI.toFloat())
|
||||
|
||||
val hobbitId = circle(410.52737 to 868.7676)
|
||||
|
||||
|
@ -14,8 +14,8 @@ data class SchemeRectangle(
|
||||
) {
|
||||
companion object {
|
||||
fun square(center: SchemeCoordinates, height: Float, width: Float): SchemeRectangle = SchemeRectangle(
|
||||
SchemeCoordinates(center.x - width / 2, center.y - height / 2),
|
||||
SchemeCoordinates(center.x + width / 2, center.y + height / 2),
|
||||
SchemeCoordinates(center.x - width / 2, center.y + height / 2),
|
||||
SchemeCoordinates(center.x + width / 2, center.y - height / 2),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -31,8 +31,8 @@ val SchemeRectangle.height get() = abs(a.y - b.y)
|
||||
|
||||
val SchemeRectangle.center get() = SchemeCoordinates((a.x + b.x) / 2, (a.y + b.y) / 2)
|
||||
|
||||
public val SchemeRectangle.topLeft: SchemeCoordinates get() = SchemeCoordinates(top, left)
|
||||
public val SchemeRectangle.bottomRight: SchemeCoordinates get() = SchemeCoordinates(bottom, right)
|
||||
public val SchemeRectangle.leftTop: SchemeCoordinates get() = SchemeCoordinates(left, top)
|
||||
public val SchemeRectangle.rightBottom: SchemeCoordinates get() = SchemeCoordinates(right, bottom)
|
||||
|
||||
fun Collection<SchemeRectangle>.wrapAll(): SchemeRectangle? {
|
||||
if (isEmpty()) return null
|
||||
|
@ -171,8 +171,8 @@ public fun SchemeView(
|
||||
|
||||
is SchemeLineFeature -> drawLine(feature.color, feature.a.toOffset(), feature.b.toOffset())
|
||||
is SchemeArcFeature -> {
|
||||
val topLeft = feature.oval.topLeft.toOffset()
|
||||
val bottomRight = feature.oval.bottomRight.toOffset()
|
||||
val topLeft = feature.oval.leftTop.toOffset()
|
||||
val bottomRight = feature.oval.rightBottom.toOffset()
|
||||
|
||||
val path = Path().apply {
|
||||
addArcRad(
|
||||
|
Loading…
Reference in New Issue
Block a user