mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Improve information when hovering wires
This commit is contained in:
@@ -4,7 +4,7 @@ import { round3Digits } from "./utils";
|
||||
|
||||
const floorSpriteCoordinates = false;
|
||||
|
||||
export const ORIGINAL_SPRITE_SCALE = "0.5";
|
||||
export const ORIGINAL_SPRITE_SCALE = "0.75";
|
||||
|
||||
export class BaseSprite {
|
||||
/**
|
||||
|
||||
@@ -713,3 +713,12 @@ export function rotateDirectionalObject(obj, rotation) {
|
||||
left: queue[3],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Modulo which works for negative numbers
|
||||
* @param {number} n
|
||||
* @param {number} m
|
||||
*/
|
||||
export function safeModulo(n, m) {
|
||||
return ((n % m) + m) % m;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { globalConfig } from "./config";
|
||||
import { safeModulo } from "./utils";
|
||||
|
||||
const tileSize = globalConfig.tileSize;
|
||||
const halfTileSize = globalConfig.halfTileSize;
|
||||
@@ -287,6 +288,15 @@ export class Vector {
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns x % f, y % f
|
||||
* @param {number} f
|
||||
* @returns {Vector} new vector
|
||||
*/
|
||||
modScalar(f) {
|
||||
return new Vector(safeModulo(this.x, f), safeModulo(this.y, f));
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes and returns the center between both points
|
||||
* @param {Vector} v
|
||||
|
||||
Reference in New Issue
Block a user