Skip to content

fix: reset canvas transform before clearing to prevent rendering artifacts#140

Open
Antamansid wants to merge 1 commit intogravity-ui:mainfrom
Antamansid:fix_clear_canvas
Open

fix: reset canvas transform before clearing to prevent rendering artifacts#140
Antamansid wants to merge 1 commit intogravity-ui:mainfrom
Antamansid:fix_clear_canvas

Conversation

@Antamansid
Copy link
Contributor

CanvasApi.clear() used clearRect without resetting the canvas transform to identity first. When external code (e.g. Events.setSelectedEvents()) called render() directly outside of the rerender() cycle, it left a dirty scroll transform on the canvas context. On the next rerender(), clearRect operated in the transformed coordinate space — and with a large canvasScrollTop, the clear area shifted entirely above the visible canvas, resulting in nothing being cleared. Subsequent component renders drew on top of stale content, producing visual ghosting artifacts.

The fix resets the transform to identity (1, 0, 0, 1, 0, 0) before clearRect, ensuring the full physical canvas is always cleared regardless of any residual transform state.

@Antamansid Antamansid requested a review from SimbiozizV as a code owner March 2, 2026 15:01
@gravity-ui-bot
Copy link
Contributor

Preview is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants