mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
use closest output as item
This commit is contained in:
parent
93ecc77792
commit
0bac871eba
@ -108,6 +108,7 @@ export class HUDWiresOverlay extends BaseHUDPart {
|
|||||||
|
|
||||||
// Go over all slots and see if they are close to mouse or not
|
// Go over all slots and see if they are close to mouse or not
|
||||||
const pinSlots = pinComp.slots;
|
const pinSlots = pinComp.slots;
|
||||||
|
let minLength = Infinity;
|
||||||
for (let i = 0; i < pinSlots.length; ++i) {
|
for (let i = 0; i < pinSlots.length; ++i) {
|
||||||
const slot = pinSlots[i];
|
const slot = pinSlots[i];
|
||||||
|
|
||||||
@ -127,7 +128,8 @@ export class HUDWiresOverlay extends BaseHUDPart {
|
|||||||
const length = mouseTilePos.sub(valueSpritePos).length();
|
const length = mouseTilePos.sub(valueSpritePos).length();
|
||||||
|
|
||||||
// If it is closer than 8 we can copy that value
|
// If it is closer than 8 we can copy that value
|
||||||
if (length <= 8) {
|
if (length < minLength) {
|
||||||
|
minLength = length;
|
||||||
value = slot.value;
|
value = slot.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user