mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
make selection relative to world
This commit is contained in:
parent
1dee6a6aa2
commit
7f5413a485
@ -41,6 +41,7 @@ export class HUDMassSelector extends BaseHUDPart {
|
||||
this.deletionMarker = Loader.getSprite("sprites/misc/deletion_marker.png");
|
||||
|
||||
this.currentSelectionStart = null;
|
||||
this.currentSelectionStartWorld = null;
|
||||
this.currentSelectionEnd = null;
|
||||
this.selectedUids = new Set();
|
||||
|
||||
@ -147,6 +148,7 @@ export class HUDMassSelector extends BaseHUDPart {
|
||||
}
|
||||
|
||||
this.currentSelectionStart = pos.copy();
|
||||
this.currentSelectionStartWorld = this.root.camera.screenToWorld(this.currentSelectionStart);
|
||||
this.currentSelectionEnd = pos.copy();
|
||||
return STOP_PROPAGATION;
|
||||
}
|
||||
@ -163,7 +165,7 @@ export class HUDMassSelector extends BaseHUDPart {
|
||||
|
||||
onMouseUp() {
|
||||
if (this.currentSelectionStart) {
|
||||
const worldStart = this.root.camera.screenToWorld(this.currentSelectionStart);
|
||||
const worldStart = this.currentSelectionStartWorld;
|
||||
const worldEnd = this.root.camera.screenToWorld(this.currentSelectionEnd);
|
||||
|
||||
const tileStart = worldStart.toTileSpace();
|
||||
@ -182,6 +184,7 @@ export class HUDMassSelector extends BaseHUDPart {
|
||||
}
|
||||
|
||||
this.currentSelectionStart = null;
|
||||
this.currentSelectionStartWorld = null;
|
||||
this.currentSelectionEnd = null;
|
||||
}
|
||||
}
|
||||
@ -198,7 +201,7 @@ export class HUDMassSelector extends BaseHUDPart {
|
||||
const boundsBorder = 2;
|
||||
|
||||
if (this.currentSelectionStart) {
|
||||
const worldStart = this.root.camera.screenToWorld(this.currentSelectionStart);
|
||||
const worldStart = this.currentSelectionStartWorld;
|
||||
const worldEnd = this.root.camera.screenToWorld(this.currentSelectionEnd);
|
||||
|
||||
const realWorldStart = worldStart.min(worldEnd);
|
||||
|
Loading…
Reference in New Issue
Block a user