mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Fixed some mouse press/release action interaction conflicts.
This commit is contained in:
parent
0fc6e9ca2c
commit
958797d7c0
@ -87,7 +87,7 @@ export class Camera extends BasicSerializableObject {
|
||||
this.downPreHandler = /** @type {TypedSignal<[Vector, enumMouseButton]>} */ (new Signal());
|
||||
this.movePreHandler = /** @type {TypedSignal<[Vector]>} */ (new Signal());
|
||||
// this.pinchPreHandler = /** @type {TypedSignal<[Vector]>} */ (new Signal());
|
||||
this.upPostHandler = /** @type {TypedSignal<[Vector]>} */ (new Signal());
|
||||
this.upPostHandler = /** @type {TypedSignal<[Vector, enumMouseButton]>} */ (new Signal());
|
||||
|
||||
this.internalInitEvents();
|
||||
this.clampZoomLevel();
|
||||
@ -767,7 +767,7 @@ export class Camera extends BasicSerializableObject {
|
||||
this.userInteraction.dispatch(USER_INTERACT_TOUCHEND);
|
||||
this.didMoveSinceTouchStart = false;
|
||||
}
|
||||
this.upPostHandler.dispatch(new Vector(x, y));
|
||||
this.upPostHandler.dispatch(new Vector(x, y), buttonKey);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -824,11 +824,24 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
/**
|
||||
* Mouse up handler
|
||||
*/
|
||||
onMouseUp() {
|
||||
onMouseUp(pos, mouseButton) {
|
||||
if (this.root.camera.getIsMapOverlayActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent releasing the wrong mouse button from cancelling other actions:
|
||||
// if not dragging, OR
|
||||
// if not deleting and the released mouse button is not left click, OR
|
||||
// if deleting and the released mouse button is not right click,
|
||||
// then ignore the release
|
||||
if (
|
||||
!this.currentlyDragging ||
|
||||
(!this.currentlyDeleting && mouseButton !== enumMouseButton.left) ||
|
||||
(this.currentlyDeleting && mouseButton !== enumMouseButton.right)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for direction lock
|
||||
if (this.lastDragTile && this.currentlyDragging && this.isDirectionLockActive) {
|
||||
this.executeDirectionLockedPlacement();
|
||||
|
@ -213,7 +213,12 @@ export class HUDMassSelector extends BaseHUDPart {
|
||||
}
|
||||
}
|
||||
|
||||
onMouseUp() {
|
||||
onMouseUp(pos, mouseButton) {
|
||||
// prevent releasing other mouse buttons from stopping a left click action
|
||||
if (mouseButton !== enumMouseButton.left) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.currentSelectionStartWorld) {
|
||||
const worldStart = this.currentSelectionStartWorld;
|
||||
const worldEnd = this.root.camera.screenToWorld(this.currentSelectionEnd);
|
||||
|
Loading…
Reference in New Issue
Block a user