Open kirchet opened 1 year ago
Added possibility to filter & ignore suggested size change events
Before:
const binding = bindCanvasElementBitmapSizeTo(canvas, { type: 'device-pixel-content-box', transform: (bitmapSize: Size, canvasElementClientSize: Size) => ({ // no way to ignore `subscribeSuggestedBitmapSizeChanged` listeners 😒 width: Math.max(bitmapSize.width, canvasElementClientSize.width), height: Math.max(bitmapSize.height, canvasElementClientSize.height), }), });
Now:
const binding = bindCanvasElementBitmapSizeTo(canvas, { type: 'device-pixel-content-box', transform: (bitmapSize: Size, canvasElementClientSize: Size) => { if (bitmapSize.width === 0 && bitmapSize.height === 0) { // ignore zero size resize events 🎉 return null; } return { width: Math.max(bitmapSize.width, canvasElementClientSize.width), height: Math.max(bitmapSize.height, canvasElementClientSize.height), } }), });
Added possibility to filter & ignore suggested size change events
Before:
Now: