CameraFit class
Immutable (tx, ty, scale) triple — a uniform-scale + translate
2D affine, the only shape used for both the host viewport-fit
camera and the draw screen's local pinch/pan camera. Implements
+, -, * so Animator<CameraFit> can interpolate it
element-wise.
vector_math.Matrix4 * double is a geometric scale — it
multiplies the rotation/scale columns only, leaving translation
un-lerped. Driving an Animator<Matrix4> directly would snap
translation to target on the first tick while scale lags,
producing a visible "shrink-then-enlarge" detour. Animating
CameraFit instead interpolates all three fields together.
Must be immutable: Animator's start captures the value
returned from getter(). If the setter mutated a shared object,
start would mutate alongside it, and subsequent ticks would
compute prev + difference*curved instead of start + difference*curved, overshooting the target.
Constructors
- CameraFit({required double tx, required double ty, required double scale})
-
A translation by (
tx,ty) and a uniformscale.const - CameraFit.fromMatrix(Matrix4 m)
-
Decompose a translate + uniform-scale Matrix4. Assumes the
matrix has no rotation and
m[0] == m[5]— true for the host camera and the draw viewer (both built by composing translate and uniform-scale only).factory
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMatrix(
) → Matrix4 - The affine as a matrix: scales by scale, then translates by (tx, ty).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator *(
double s) → CameraFit -
Every element times
s. -
operator +(
CameraFit o) → CameraFit - The element-wise sum.
-
operator -(
CameraFit o) → CameraFit - The element-wise difference.
-
operator ==(
Object other) → bool -
The equality operator.
override