computeScaleDelta static method
Computes the geometric scale ratio from sourceSize to targetSize.
Uses the square root of the area ratio, which treats width and height symmetrically:
Δ_scale = √(targetArea / sourceArea)
Returns 1.0 when sourceSize is zero-area (zero-sized triggers).
Implementation
static double computeScaleDelta({
required Size sourceSize,
required Size targetSize,
}) {
final sourceArea = sourceSize.width * sourceSize.height;
final targetArea = targetSize.width * targetSize.height;
if (sourceArea <= 0.0) return 1.0;
return math.sqrt(targetArea / sourceArea);
}