RoundRect with centered anchors moves slightly when rotated
- Dominant language
- Kotlin
- Stars
- 3k
- Forks
- 148
- Avg merge
- 13h 44m
- Merged PRs (30d)
- 1
Description
Description: See title
Example:

SolidRects are not affected, see:

code:
```
suspend fun main() = Korge(width = 480, height = 640, bgcolor = Colors["#2b2b2b"]) {
val playground = roundRect(width = views.virtualWidth / 2.0, height = views.virtualHeight / 2.0, rx = 5.0, fill = Colors["#4a4f4e"]) {
x = views.virtualWidth / 2.0 - width / 2.0
y = views.virtualHeight / 2.0 - height / 2.0
}
roundRect(width = playground.width / 10.0, height = playground.height / 10.0, rx = 5.0, fill = Colors["#457f80"]) {
anchor(0.5, 0.5) // or center()
x = playground.x + playground.width / 2
y = playground.y + playground.height / 2
enableFlip()
}
}
suspend fun View.enableFlip() {
var scale = 2.0
var isAnimating = false
var rotation = 180
onClick {
if (!isAnimating) {
isAnimating = true
scale *= -1
animate {
scaleBy(scale, 0.0)
rotateTo(rotation.degrees, time = 0.milliseconds)
}
rotation += -180 * -1
isAnimating = false
}
}
}
```
System:
IntelliJ IDEA 2021.1 (Ultimate Edition)
Build #IU-211.6693.111, built on April 6, 2021
Runtime version: 11.0.10+9-b1341.35 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
Linux 5.11.13-arch1-1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 16
Non-Bundled Plugins: IdeaVIM (0.66), Key Promoter X (2021.1.1), com.arcticicestudio.nord.jetbrains (0.13.0), com.intellij.nativeDebug (211.6693.111), com.mnr.java.intellij.idea.plugin.base64helper (2.0.3), detekt (1.16.0), org.intellij.plugins.hcl (0.7.10), org.jetbrains.plugins.go-template (211.6693.44), com.intellij.kubernetes (211.6693.108), com.soywiz.korge.korge-intellij-plugin (2.0.6.1), kotest-plugin-intellij (1.1.31-IC-2021.1)
Kotlin: 211-1.4.32-release-IJ6693.72
Current Desktop: i3
korgePluginVersion=2.0.7.1
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the provided Kotlin example and compare the roundRect behavior with SolidRects while rotating the centered anchor. Trace the roundRect, anchor or center, and enableFlip paths to find where the position changes. Done means a centered roundRect remains stationary during rotation, matching the SolidRect behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100