-
-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Screen element graphics anchor is broken in 0.28.0-alpha.547 #2636
Comments
This isn't well documented, but The anchor on const screenElement = new ex.ScreenElement({..});
screenElement.anchor = ex.Vector.Half; I've pushed an update to the documentation to highlight this gap excaliburjs/excaliburjs.github.io@dc1f614 |
Hi @onarheim The story: I have checked it's working in |
@ikiselev1989 Interesting, I'll dig into those versions! |
@ikiselev1989 Can you send me more code about your specific situation? I suspect something trickier might be happening. This is what I built to try and reproduce and so far it seems to be accurately centering the graphics. Let me know if I'm misunderstanding something as well var engine = new ex.Engine({
width: 600,
height: 400
});
var image = new ex.ImageSource('./spritefont.png');
var loader = new ex.Loader([image]);
var screenElement = new ex.ScreenElement({
pos: ex.vec(0, 0),
width: 200,
height: 200
});
screenElement.graphics.use(image.toSprite(), { anchor: ex.vec(0.5, 0.5) });
engine.currentScene.add(screenElement);
engine.start(loader); |
@eonarheim Hi! Of course. I want to use anchor in center of ScreenElement and add its graphics in the same place with anchor in center.
|
===:clipboard: PR Checklist :clipboard:=== - [x] :pushpin: issue exists in github for these changes - [x] :microscope: existing tests still pass - [x] :see_no_evil: code conforms to the [style guide](https://github.com/excaliburjs/Excalibur/blob/main/STYLEGUIDE.md) - [x] 📐 new tests written and passing / old tests updated with new scenario(s) - [x] 📄 changelog entry added (or not needed) ================== Closes #2636 ## Changes: - Updates ex.ScreenElement logic to properly handle constructor parameters
@ikiselev1989 Theoretically fixed, let me know if the latest alpha doesn't address the issue! |
@eonarheim Hi! Sorry for late. |
Steps to Reproduce
Create new screen element. Add graphics to it.
Expected Result
Graphics is centered on element.
Actual Result
Graphics is not centered on element.
The text was updated successfully, but these errors were encountered: