fix: improve text sharpness on zoom with tighter buckets and reliable init

Fix text staying blurry on zoom by ensuring the first setZoomBucket call
always applies (PixiJS v8 defaults to auto-resolution which skipped the
initial bucket=1 assignment), listening on both 'moved' and 'zoomed'
viewport events, and tightening bucket thresholds from 6 to 9 levels.
This commit is contained in:
Hiren Kangad
2026-03-13 11:33:57 +05:30
parent 470693266e
commit f978153a83
3 changed files with 16 additions and 6 deletions
+8 -5
View File
@@ -21,11 +21,14 @@ import { StickySprite } from './sprites/StickySprite';
* Fewer buckets = fewer re-rasterizations = better perf.
*/
export function getTextZoomBucket(scale: number): number {
if (scale < 0.4) return 0.5;
if (scale < 0.75) return 0.75;
if (scale < 1.25) return 1;
if (scale < 1.75) return 1.5;
if (scale < 2.5) return 2;
if (scale < 0.3) return 0.25;
if (scale < 0.5) return 0.5;
if (scale < 0.8) return 0.75;
if (scale < 1.1) return 1;
if (scale < 1.4) return 1.25;
if (scale < 1.8) return 1.5;
if (scale < 2.2) return 2;
if (scale < 3.0) return 2.5;
return 3;
}