campaignCanvasDesignScale function
Converts authored logical pixels into runtime pixels for any campaign surface. Full-width surfaces may grow with the viewport; floating surfaces have a modest upscale cap so they do not become disproportionately large.
Implementation
double campaignCanvasDesignScale({
required double viewportWidth,
required double designWidth,
bool fullWidth = false,
}) {
final safeDesignWidth = designWidth > 0 ? designWidth : 360.0;
final scale = viewportWidth / safeDesignWidth;
return fullWidth ? scale : math.min(maxCampaignCanvasUpscale, scale);
}