-
-
Notifications
You must be signed in to change notification settings - Fork 654
Open
Labels
Description
Describe the bug
The new documentation says UISpriteElement.floating is default false, as inherited from Sprite.floating -> Renderable.floating: https://melonjs.github.io/melonJS/classes/UISpriteElement.html#floating .
Even though the UISpriteElement and other inherited classes change the floating property to default true and are correctly documented in jsdoc, e.g.
melonJS/src/renderable/ui/uispriteelement.js
Lines 77 to 83 in a7ee9e0
| * if this UISpriteElement should use screen coordinates or local coordinates | |
| * (Note: any UISpriteElement elements added to a floating parent container should have their floating property to false) | |
| * @see Renderable.floating | |
| * @type {boolean} | |
| * @default true | |
| */ | |
| this.floating = true; |
To Reproduce
- Implement a UISpriteElement
- Instantiate it and place it in a container (world or whichever you like that is movable)
- move that container (.translate(), .centerOn(), etc.)
- UISpriteElement stays at its instantiated screen coordinates instead of moving with the container coordinates.
Expected behavior
UISpriteElement should move with the container if, as the documentation says, floating=false.
Device (please complete the following information):
- Device: Desktop PC
- OS: Arch Linux (up to date 20240702)
- Browser: all tested (Chromium, Firefox, Vanadium on Android)
- melonJS Version: 17.3.0