Skip to content

PopupMenu from OptionButton placed at wrong position and with wrong size when Camera2D has Zoom value other than (1,1) #68554

@CentiGames

Description

@CentiGames

Godot version

Godot Engine v4.0.beta4.official (e675154)

System information

Windows 10, GeForce RTX 3070 (Driver version 526.86), forward_plus rendering method

Issue description

When using an OptionButton, the PopupMenu containing its options is placed at an incorrect position and its size is wrong as well, if the current Camera2D has a Zoom value that is different from its default value (1,1).

Examples

Here is an example how the PopupMenu is placed when the Camera2D is using Zoom (4,4):
image

Another example, using Zoom (0.5, 0.5):
image

And here is an example how the PopupMenu is placed correctly, but only when the Camera2D uses Zoom (1,1)
image

What I tested:

I tested turning off display/window/subwindows/embed_subwindows however, this does not change anything, except that at high Zoom values the PopupMenu extends beyond the original window. I also tested all three options for display/window/stretch/mode, however, this also does not change anything.

While searching for anything related to this issue, I found Issue #54030 , which describes incorrect PopupMenu when using canvas_items stretch mode, however, the regression regarding that issue seems to be fixed?

Steps to reproduce

  • Create a new scene
  • Place a CanvasLayer Node
  • To this CanvasLayer, add an OptionButton child
  • Add e.g. 3 items to the OptionButton so you can test it
  • Add a Camera2D node to the root node
  • Set the 'Zoom' value of the Camera2D to something else than (1,1), I used (4,4)
  • Check the 'Current' checkbox of the Camera2D
  • Run the scene and then press the OptionButton

Scene Tree:
image
Camera2D:
image

Minimal reproduction project

Here is a minimal reproduction project: OptionsMenuTest.zip (I used Godot 4 Beta 4)

Simply run the main scene, you will see that the PopUpMenu will be placed wrongly, as the Camera2D is set to current and Zoom to something other than (1,1). If you change the zoom to (1,1) the PopupMenu will be placed correctly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions