fix(deck): scale key icons symmetrically (aspect-preserving contain fit) - #595
Merged
Conversation
Repo and agent pane icons on Stream Deck keys were drawn with drawImage(bitmap, x, y, size, size), mapping the whole source into a square slot and stretching any non-square icon asymmetrically. Add containIconRect: the largest centered rect with the bitmap's intrinsic aspect ratio inside the square slot, so icons only ever scale symmetrically. Dimensionless (viewBox-only) SVGs report 0x0 intrinsics and keep the full-square fallback, preserving the mandatory explicit 5-arg drawImage rule that guards the drawn-blank SVG trap. Generated with Amplifier Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
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.
Summary
Repo and agent pane icons on Stream Deck keys were drawn with
drawImage(bitmap, x, y, size, size), mapping the whole source image into the square icon slot — any non-square icon got scaled independently per axis and stretched.containIconRect(): computes the largest centered rect with the bitmap's intrinsic aspect ratio inside the square slot, so icons only ever scale symmetrically (letterboxed/pillarboxed instead of stretched).drawIconContained()helper.drawImagerule that guards the drawn-blank SVG trap (repo_icon_detect.rs serves dimensionless SVGs first-class).Testing
renderKeyintegration for both repo-icon and pane-icon draw paths.npm run test:unit: 378 files / 4560 tests passed.npm run typecheckclean; eslint clean on touched files.Generated with Amplifier