GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

[$5 bounty] Text object at wrong position (and moves!)

Open PascalLadalle opened this issue 5 years ago • 13 comments

Describe the bug

A picture is worth a thousand words... well I have four! Please look on each picture at the position of "Score :" in the editor on the left, and in preview on the right. All fine here: nobug1 Score is higher than 10, still fine. nobug1b Text object has been rotated 90°. bug1 Score is higher than 10. bug1b

To Reproduce

Place a Text object on an external layout. Rotate the object. Load the layout in a scene.

Other details

GD beta 65, Windows 10

PascalLadalle avatar Mar 14 '19 21:03 PascalLadalle

Can you not reproduce this issue?

PascalLadalle avatar Mar 29 '19 14:03 PascalLadalle

Can you provide an example file ? Because i tried few things but can reproduce... You seems to use the default font ? No breakline or width limitation on text field ?

KinkGD avatar Apr 01 '19 12:04 KinkGD

Yes @KinkGD , default font and nothing fancy, rotation only. I just tried the following, it reproduces the issue for me: Create a new game using the default platformer example, rotate the score text 90° and place it next to the coin icon. Grab coins and watch the text move. image

PascalLadalle avatar Apr 01 '19 16:04 PascalLadalle

So this is surprising to say the least but per se "working as intended". The thing is that the position of the object is determined by its origin point on the top left BUT the center, used for rotation, is the middle of the object. This means that when the text grow, the center moves to the right, so the object also seems to move to the right when it's rotated.

A solution could be to allow to specify the origin point to be the center, but not sure if there is a better way.

4ian avatar Apr 01 '19 17:04 4ian

The thing is that the position of the object is determined by its origin point on the top left

I placed a marker on ScoreX/Y(), see what happens: image

The second position doesn't look like a top-left corner 😬 (the position was updated, of course)

This means that when the text grow, the center moves to the right, so the object also seems to move to the right when it's rotated.

But the object is rotated, so the center should in fact move down, right?

Am I right to assume that this issue is related to what I will call a weirdity, not to call it a bug: image

PascalLadalle avatar Apr 01 '19 18:04 PascalLadalle

RotatedText That's why ;)

The non-rotated object selection mask in the IDE is a bad design that comes from the ice era :D

Lizard-13 avatar Apr 04 '19 17:04 Lizard-13

@PascalLadalle it is solved by beta 110?

From patch note:

Fix sprite objects updating their displayed image one frame too late: This fixes some "flickering" when a sprite is just created, when a scene is changed or when external layout objects are created on a scene. This also fix objects that are not at the proper size/position/angle just after being created in events.

Bouh avatar May 29 '21 15:05 Bouh

Nope, issue is still there, I'm afraid. imageimage

PascalLadalle avatar May 29 '21 18:05 PascalLadalle

Can you drop the project here, please?

Bouh avatar May 29 '21 18:05 Bouh

Default platformer with rotated score text: My project28.zip

PascalLadalle avatar May 29 '21 21:05 PascalLadalle

There is 3 type of text objects with the same issue, https://www.bountysource.com/issues/71408652-text-object-at-wrong-position-and-moves

Here is another project with all types of text objects, all have their own problems when the angle is different from zero. Visually the text objects move, that's the problem, their positions stay the same which is fine. The bounding box does not adapt to the text when it is updated.

Project_example.zip

Bouh avatar May 30 '21 13:05 Bouh

Bouh has contributed $5.00 to this issue on Rysolv.

The total bounty is now $5.00. Solve this issue on Rysolv to earn this bounty.

rysolv-bot avatar Jun 17 '22 12:06 rysolv-bot

In addition to this issue, I link this thread on the forum.

Bouh avatar Aug 03 '22 21:08 Bouh