Repository navigation
Conversation
A Deck that creates its own canvas drew its first frames into the default 300x150 drawing buffer, stretched over the real canvas size, until luma reported the size. Apply the CSS size when the canvas is created and skip frames until it has been measured.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
Reviewed by Cursor Bugbot for commit d14b304. Configure here.
MapboxOverlay redraws from the map render event, which bypassed the check in the render loop. Move the check to redraw(), and stop waiting when luma measured the canvas before the resize handler was installed.
luma reports the default canvas size for a canvas that is detached or hidden. Only stop holding redraws once a size is reported for a canvas that has a layout, so an overlay inserted late is not drawn at 300x150.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #10599
Background
A
Deckthat creates its own canvas draws its first frames into the default 300x150 drawing buffer, stretched over the real canvas size, until luma reports the size. The issue describes this forMapboxOverlay, but a standaloneDeckwith aparentdoes the same. Deck now sizes the canvas when it creates it and skips frames until luma has measured it.Change List
Deck: apply the CSS size when the canvas is createdDeck: skip frames until the owned canvas is measuredwidthandheightare numbersvitest --project headless,--project renderandyarn lintNote
Medium Risk
Touches core
redraw()and canvas lifecycle indeck.ts, but behavior is gated to auto-created canvases without explicit numeric dimensions; mis-detection could delay or skip an initial draw.Overview
Fixes first-frame rendering when Deck auto-creates its own canvas (e.g. MapboxOverlay): layers were briefly drawn into the default 300×150 drawing buffer and stretched until luma measured the real size.
Deck now applies CSS
width/heightas soon as the owned canvas is created, tracks_ownedCanvasNeedsSizewhen numericwidth/heightprops are not set, and skipsredraw()until the canvas has non-zero layout and luma reports a resize (or the context was already initialized on device setup). Redraw flags are preserved so the next resize still paints.Mapbox overlay tests assert the first completed frame uses the map’s 400×300 drawing buffer, including when the overlay DOM is inserted late.
Reviewed by Cursor Bugbot for commit 8a44568. Bugbot is set up for automated code reviews on this repo. Configure here.