mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Created helper method for getting appropriate mouse button value for camera panning as according to settings
This commit is contained in:
parent
0ca897bf86
commit
8557d4523e
@ -510,6 +510,15 @@ export class Camera extends BasicSerializableObject {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {enumMouseButton} value for the key to pan the camera as according to settings
|
||||||
|
*/
|
||||||
|
getMousePanButton() {
|
||||||
|
return this.root.app.settings.getSetting("middleMousePan")
|
||||||
|
? enumMouseButton.middle
|
||||||
|
: enumMouseButton.left;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mousewheel event
|
* Mousewheel event
|
||||||
* @param {WheelEvent} event
|
* @param {WheelEvent} event
|
||||||
@ -690,12 +699,7 @@ export class Camera extends BasicSerializableObject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (buttonKey === this.getMousePanButton()) {
|
||||||
buttonKey ===
|
|
||||||
(this.root.app.settings.getSetting("middleMousePan")
|
|
||||||
? enumMouseButton.middle
|
|
||||||
: enumMouseButton.left)
|
|
||||||
) {
|
|
||||||
this.touchPostMoveVelocity = new Vector(0, 0);
|
this.touchPostMoveVelocity = new Vector(0, 0);
|
||||||
this.currentlyMoving = true;
|
this.currentlyMoving = true;
|
||||||
this.lastMovingPosition = pos;
|
this.lastMovingPosition = pos;
|
||||||
@ -750,14 +754,7 @@ export class Camera extends BasicSerializableObject {
|
|||||||
* @param {enumMouseButton} buttonKey
|
* @param {enumMouseButton} buttonKey
|
||||||
*/
|
*/
|
||||||
combinedSingleTouchStopHandler(x, y, buttonKey) {
|
combinedSingleTouchStopHandler(x, y, buttonKey) {
|
||||||
if (
|
if (this.currentlyPinching || (this.currentlyMoving && buttonKey === this.getMousePanButton())) {
|
||||||
this.currentlyPinching ||
|
|
||||||
(this.currentlyMoving &&
|
|
||||||
buttonKey ===
|
|
||||||
(this.root.app.settings.getSetting("middleMousePan")
|
|
||||||
? enumMouseButton.middle
|
|
||||||
: enumMouseButton.left))
|
|
||||||
) {
|
|
||||||
this.currentlyMoving = false;
|
this.currentlyMoving = false;
|
||||||
this.currentlyPinching = false;
|
this.currentlyPinching = false;
|
||||||
this.lastMovingPosition = null;
|
this.lastMovingPosition = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user