mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Cleanup click detector code
This commit is contained in:
@@ -243,20 +243,10 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
* @param {boolean} cancelAction
|
||||
*/
|
||||
onCanvasClick(mousePos, cancelAction = false) {
|
||||
if (cancelAction) {
|
||||
if (this.currentMetaBuilding.get()) {
|
||||
this.currentMetaBuilding.set(null);
|
||||
} else {
|
||||
this.deleteBelowCursor();
|
||||
}
|
||||
// Prevent any other canvas clicks
|
||||
if (this.currentMetaBuilding.get()) {
|
||||
return STOP_PROPAGATION;
|
||||
}
|
||||
|
||||
if (!this.currentMetaBuilding.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
return STOP_PROPAGATION;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -479,13 +469,18 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
}
|
||||
|
||||
// Deletion
|
||||
if (button === enumMouseButton.right && !this.currentMetaBuilding.get()) {
|
||||
if (button === enumMouseButton.right && !metaBuilding) {
|
||||
this.currentlyDragging = true;
|
||||
this.currentlyDeleting = true;
|
||||
this.lastDragTile = this.root.camera.screenToWorld(pos).toTileSpace();
|
||||
this.currentMetaBuilding.set(null);
|
||||
return STOP_PROPAGATION;
|
||||
}
|
||||
|
||||
// Cancel placement
|
||||
if (button === enumMouseButton.right && metaBuilding) {
|
||||
this.currentMetaBuilding.set(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user