Skip to content

Incorrect scaling of icons in SwitcherRendering on New UI #26

@AB-xdev

Description

@AB-xdev

This problem affects all our plugins.

First discovered in xdev-software/intellij-plugin-openrewriter#19 (complete description)
Tracked upstream by https://youtrack.jetbrains.com/issue/IDEA-354465

Short summary

Steps to reproduce

  1. Install a plugin such as OpenRewriter X
  2. Enable the "New UI"
  3. Open the "Switcher" (Ctrl + Tab) or "Recent Files" (Ctrl + E)

Expected result (correct result):

icon is rendered way to large

Actual result (faulty result):

icon is rendered with expected size, like it was in 2023.2:

g

Additional information

There seems to be a problem with how the icon scaling is applied inside https://github.com/JetBrains/intellij-community/blob/def6433a5dd9f0a984cbc6e2835d27c97f2cb5f0/platform/platform-impl/src/com/intellij/ide/actions/SwitcherRendering.kt#L113-L119

New versions of IDEA (some time after 2023.2) use CachedImageIcon while 2023.2 used ToolWindowIcon for window.icon.

The scaling of CachedImageIcon seems to be applied incorrectly in this context apparently using the following scheme:

16 (reference width)/13 (incorrect detected width of CachedImageIcon) * 512 (actual width of icon), which results in 630 instead of the expected 16

Applied Counter-Measures/Workarounds

  • Fix pluginIcon to a size of 16 so that broken scaling is not invoked
    • like this: <svg width="16" height="16" viewBox="0 0 40 40" style="fill:none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  • Release new version of plugins ASAP as IDEA 2024.2 will enable "New UI" by default

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions