jeff
01/11/2021, 8:28 PM.scale
of most views does not affect the output of getBounds()
(SolidRect for example). But changing the .scale
of Text
views does (slightly) -- is that expected?jeff
01/11/2021, 8:29 PMclass TestScene : Scene() {
override suspend fun Container.sceneInit() {
val left = 200
val right = 700
solidRect(5, 300) {
xy( left - 5, 100)
}
solidRect(5, 300) {
xy( right, 100)
}
val redBox = solidRect(100, 100, Colors.RED) {
xy(500, 500)
}
val text = text("This is a Message") {
xy(left, 200)
fontSize = 32.0
}
println("redBox")
println("bounds = ${redBox.getBounds()}")
redBox.scale = 0.2
println("==0.2==")
println("bounds = ${redBox.getBounds()}")
redBox.scale = 2.0
println("==2.0==")
println("bounds = ${redBox.getBounds()}")
redBox.scale = 1.0
println("==1.0==")
println("bounds = ${redBox.getBounds()}")
println("=default==")
println("bounds = ${text.getBounds()}")
text.scale = 0.2
println("==0.2==")
println("bounds = ${text.getBounds()}")
text.scale = 2.0
println("==2.0==")
println("bounds = ${text.getBounds()}")
text.scale = 1.0
println("==1.0==")
println("bounds = ${text.getBounds()}")
val desiredWidth = right - left
keys {
down(<http://Key.SPACE|Key.SPACE>) {
text.text = "word".repeat(Random.nextInt(1, 15))
val actualWidth = text.getBounds().width
text.scale = desiredWidth / actualWidth
}
}
}
Deactivated User
01/11/2021, 8:30 PMjeff
01/11/2021, 8:31 PMredBox
bounds = Rectangle(x=0, y=0, width=100, height=100)
==0.2==
bounds = Rectangle(x=0, y=0, width=100, height=100)
==2.0==
bounds = Rectangle(x=0, y=0, width=100, height=100)
==1.0==
bounds = Rectangle(x=0, y=0, width=100, height=100)
=default==
bounds = Rectangle(x=0.7486979166666667, y=0, width=233.7391304347826, height=31.304347826086957)
==0.2==
bounds = Rectangle(x=0.14973958333333334, y=0, width=250.43478260869566, height=41.73913043478261)
==2.0==
bounds = Rectangle(x=1.4973958333333335, y=0, width=231.65217391304347, height=29.217391304347824)
==1.0==
bounds = Rectangle(x=0.7486979166666667, y=0, width=233.7391304347826, height=31.304347826086957)
Deactivated User
01/11/2021, 8:32 PMDeactivated User
01/11/2021, 8:33 PMDeactivated User
01/11/2021, 8:33 PMDeactivated User
01/11/2021, 8:33 PMjeff
01/11/2021, 8:33 PMjeff
01/11/2021, 8:33 PMDeactivated User
01/11/2021, 8:33 PMjeff
01/11/2021, 8:34 PMredBox
bounds = Rectangle(x=0, y=0, width=100, height=100)
==0.2==
bounds = Rectangle(x=0, y=0, width=100, height=100)
==2.0==
bounds = Rectangle(x=0, y=0, width=100, height=100)
==1.0==
bounds = Rectangle(x=0, y=0, width=100, height=100)
=default==
bounds = Rectangle(x=0, y=0, width=238, height=16)
==0.2==
bounds = Rectangle(x=0, y=0, width=238, height=16)
==2.0==
bounds = Rectangle(x=0, y=0, width=238, height=16)
==1.0==
bounds = Rectangle(x=0, y=0, width=238, height=16)
Deactivated User
01/11/2021, 8:34 PMDeactivated User
01/11/2021, 8:35 PMjeff
01/11/2021, 8:36 PMjeff
01/11/2021, 8:37 PM=default==
bounds = Rectangle(x=1.5625, y=0, width=232, height=30)
==0.2==
bounds = Rectangle(x=1.5625, y=0, width=232, height=30)
==2.0==
bounds = Rectangle(x=1.5625, y=0, width=232, height=30)
==1.0==
bounds = Rectangle(x=1.5625, y=0, width=232, height=30)
jeff
01/11/2021, 8:40 PMDeactivated User
01/11/2021, 9:05 PMjeff
01/11/2021, 9:08 PMjeff
01/11/2021, 9:13 PMDeactivated User
01/11/2021, 10:25 PM