on master help sign in
Restore button press animation with direct transform property mutations
550b6a9iko
client/Buttons.fs+7−2
@@ -15,8 +15,13 @@ module Buttons =
15 match shadowRef.TryValue with
15 match shadowRef.TryValue with
16 | None -> ()
16 | None -> ()
17 | Some c ->
17 | Some c ->
18− let offset = if pressed then 8. else 12.
18+ let offset = if pressed then 4. else 12.
19+ match c.RenderTransform with
20+ | :? TranslateTransform as t ->
21+ t.X <- offset
22+ t.Y <- offset
23+ | _ ->
19− c.RenderTransform <- Avalonia.Media.TranslateTransform(offset, offset)
24+ c.RenderTransform <- TranslateTransform(offset, offset)
20
25
21 Component(text) {
26 Component(text) {
22 Grid() {
27 Grid() {