Reduce quick switch layout churn and flatten planar depth transforms

This commit is contained in:
2026-11-07 19:44:42 +00:00
parent 53a9cc78a3
commit ef0571c562
10 changed files with 284 additions and 17 deletions
@@ -46,6 +46,37 @@ void main() {
}
});
test(
'flat deck depth keeps the same projection on the cheaper affine path',
() {
for (final depth in [-18.0, 0.0, 18.0]) {
final pose = QuickSwitchPose(
translation: const Offset(-.7, .04),
rotationZ: -.04,
depth: depth,
scale: .96,
);
final original = Matrix4.identity()
..setEntry(3, 2, .0012)
..translateByDouble(-.7 * 560, .04 * 635, depth, 1)
..rotateZ(-.04)
..scaleByDouble(.96, .96, .96, 1);
final affine = pose.transform(full.size);
expect(affine.entry(3, 2), 0);
for (final point in [
Offset.zero,
const Offset(560, 635),
const Offset(280, 320),
]) {
final expected = MatrixUtils.transformPoint(original, point);
final actual = MatrixUtils.transformPoint(affine, point);
expect(actual.dx, closeTo(expected.dx, .000001));
expect(actual.dy, closeTo(expected.dy, .000001));
}
}
},
);
test('all choices have finite bounded geometry throughout a transition', () {
for (final style in QuickSwitchAnimation.values) {
for (final outgoing in [true, false]) {