1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Refactor building placer

This commit is contained in:
tobspr
2020-06-17 13:12:39 +02:00
parent 4b9df76f2f
commit 84969a9205
11 changed files with 625 additions and 469 deletions

View File

@@ -978,3 +978,17 @@ export function formatItemsPerSecond(speed, double = false) {
: T.ingame.buildingPlacement.infoTexts.itemsPerSecond.replace("<x>", "" + round2Digits(speed)) +
(double ? " " + T.ingame.buildingPlacement.infoTexts.itemsPerSecondDouble : "");
}
/**
* Finds the corner point between two vectors
* @param {Vector} a
* @param {Vector} b
*/
export function findCornerBetweenPoints(a, b) {
const delta = b.sub(a);
if (Math_abs(delta.x) > Math_abs(delta.y)) {
return new Vector(a.x, b.y);
} else {
return new Vector(b.x, a.y);
}
}