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:
@@ -185,12 +185,15 @@ export function useCanvasSetup(deps: CanvasSetupDeps) {
|
||||
undoRef.current = new UndoManager(scene);
|
||||
|
||||
// Zoom-bucket text sharpness — re-rasterize visible text when zoom crosses bucket boundary
|
||||
// Listen on both 'zoomed' and 'moved' — pixi-viewport may only fire 'moved' for some zoom types
|
||||
const sharpness = new TextSharpnessManager(viewport, scene);
|
||||
const onZoomBucketCheck = () => { sharpness.check(); };
|
||||
viewport.on('zoomed', onZoomBucketCheck);
|
||||
viewport.on('moved', onZoomBucketCheck);
|
||||
scene.onItemCreated = (item) => { sharpness.applyToItem(item); };
|
||||
sharpnessCleanupRef.current = () => {
|
||||
viewport.off('zoomed', onZoomBucketCheck);
|
||||
viewport.off('moved', onZoomBucketCheck);
|
||||
scene.onItemCreated = null;
|
||||
sharpness.destroy();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user