Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Optimize piece rendering and caching
- Refactored `_restorePieces` to optionally use a cache (piecesCanvas) for improved performance. - Updated `resizeCanvas` to handle resizing of piecesCanvas and call `_restorePieces` with caching disabled for initial rendering. - Modified `drawPiece` to draw pieces on piecesCanvas first, then copy to the main canvas, reducing the need for frequent redraws. Changes: - Added `useCache` parameter to `_restorePieces` method for conditional caching. - Introduced `piecesCanvas` and `piecesCtx` for optimized piece rendering. - Adjusted `drawPiece` method to use caching canvas before drawing on the main canvas.
- Loading branch information