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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param {WheelEvent} event
|
||||
@ -690,12 +699,7 @@ export class Camera extends BasicSerializableObject {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
buttonKey ===
|
||||
(this.root.app.settings.getSetting("middleMousePan")
|
||||
? enumMouseButton.middle
|
||||
: enumMouseButton.left)
|
||||
) {
|
||||
if (buttonKey === this.getMousePanButton()) {
|
||||
this.touchPostMoveVelocity = new Vector(0, 0);
|
||||
this.currentlyMoving = true;
|
||||
this.lastMovingPosition = pos;
|
||||
@ -750,14 +754,7 @@ export class Camera extends BasicSerializableObject {
|
||||
* @param {enumMouseButton} buttonKey
|
||||
*/
|
||||
combinedSingleTouchStopHandler(x, y, buttonKey) {
|
||||
if (
|
||||
this.currentlyPinching ||
|
||||
(this.currentlyMoving &&
|
||||
buttonKey ===
|
||||
(this.root.app.settings.getSetting("middleMousePan")
|
||||
? enumMouseButton.middle
|
||||
: enumMouseButton.left))
|
||||
) {
|
||||
if (this.currentlyPinching || (this.currentlyMoving && buttonKey === this.getMousePanButton())) {
|
||||
this.currentlyMoving = false;
|
||||
this.currentlyPinching = false;
|
||||
this.lastMovingPosition = null;
|
||||
|
Loading…
Reference in New Issue
Block a user