mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site): clamp lander position on landing to keep feet on pad (#25026)
This commit is contained in:
@@ -2137,6 +2137,14 @@ export const LunarLander: FC = () => {
|
||||
landerAngle = 0;
|
||||
thrusting = false;
|
||||
landerY = pad.y - 8;
|
||||
// Keep both feet (+-11px) on the pad so the
|
||||
// lander cannot get stuck on the terrain slope
|
||||
// at the pad edge on relaunch.
|
||||
const footHalf = 11;
|
||||
landerX = Math.max(
|
||||
pad.x + footHalf,
|
||||
Math.min(pad.x + pad.width - footHalf, landerX),
|
||||
);
|
||||
landedOnStation = pad.isStation;
|
||||
|
||||
if (pad.isStation) {
|
||||
|
||||
Reference in New Issue
Block a user