Commit 4b89b0d
committed
PanZoom: snap to pixel grid only at rest to kill spring-settle shiver (#177)
UpdateTransform() rounded both translations every frame. During a spring's
settling tail the pan translation moves <1px over many frames, so per-frame
rounding quantized that smooth glide into a 1px staircase while the unrounded
Scale term kept sliding underneath it - a visible shiver, worst on
high-refresh displays where the tail is sampled more finely.
Rounding only buys crisp 1:1 / the NVIDIA #55 fix at rest (at fractional
animation scales the image is sub-pixel sampled regardless), so gate it on a
new CanvasViewState.SnapTranslation flag: round when settled, use raw floats
during animation. Mirrors how XAML's Image behaves (layout rounding at rest,
smooth sub-pixel resampling while a composition scale animation runs).
Make PanZoomAnimationOnGoing the single source of truth - its setter keeps
SnapTranslation == !value, so snapping can never be left off at rest. Every
stop path (FinishSpringAnimation, StopAnimationSnappingToTarget, shrug
completion) clears the flag before rebuilding the transform so the resting
frame is snapped.1 parent a851017 commit 4b89b0d
2 files changed
Lines changed: 52 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
89 | 105 | | |
90 | 106 | | |
91 | 107 | | |
| |||
852 | 868 | | |
853 | 869 | | |
854 | 870 | | |
855 | | - | |
| 871 | + | |
856 | 872 | | |
857 | 873 | | |
858 | 874 | | |
| |||
885 | 901 | | |
886 | 902 | | |
887 | 903 | | |
888 | | - | |
| 904 | + | |
889 | 905 | | |
890 | 906 | | |
891 | 907 | | |
| |||
910 | 926 | | |
911 | 927 | | |
912 | 928 | | |
913 | | - | |
| 929 | + | |
914 | 930 | | |
915 | 931 | | |
916 | 932 | | |
| |||
954 | 970 | | |
955 | 971 | | |
956 | 972 | | |
957 | | - | |
| 973 | + | |
958 | 974 | | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
959 | 979 | | |
960 | 980 | | |
961 | 981 | | |
| |||
968 | 988 | | |
969 | 989 | | |
970 | 990 | | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
971 | 995 | | |
972 | 996 | | |
973 | 997 | | |
| |||
993 | 1017 | | |
994 | 1018 | | |
995 | 1019 | | |
996 | | - | |
997 | 1020 | | |
998 | 1021 | | |
999 | 1022 | | |
| |||
1122 | 1145 | | |
1123 | 1146 | | |
1124 | 1147 | | |
| 1148 | + | |
| 1149 | + | |
1125 | 1150 | | |
1126 | 1151 | | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | 1152 | | |
1131 | 1153 | | |
1132 | 1154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
19 | 31 | | |
20 | 32 | | |
21 | 33 | | |
22 | 34 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
26 | 40 | | |
27 | 41 | | |
28 | 42 | | |
| |||
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
37 | 52 | | |
38 | 53 | | |
39 | 54 | | |
| |||
0 commit comments