-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix: fromScreen not using viewport scale, mousePos() not working with letterbox/stretch #436
base: master
Are you sure you want to change the base?
Conversation
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. World and local have nothing to do with viewport scale.
Viewport scale only makes sense between screen and world.
Additionally, you don't want to divide each time, it is better to store 1 / factor and multiply instead. |
So scale is fine now, it's stretch that is bugged. If kaplay({
scale: 3,
width: 20,
height: 40,
stretch: true
});
const x = add([
anchor("center"),
circle(3),
color(RED),
pos(),
]);
getTreeRoot().use(pos());
onMouseMove(pos => {
x.pos = getTreeRoot().fromScreen(pos);
}); |
Yeah, when stretch is used, you no longer have a uniform scale. You need a vec2 in that case. |
The question is if there's an user case using only Stretch without letterbox |
resolved conflicts in commit 894d9df |
no idea for fail |
Description
Issues or related