1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Attempted to migrate middle click to pan only and away from the main click code. Turning on setting breaks camera panning.

Unsure about the correctness of the change. Still learning the code org.
This commit is contained in:
David Triphon 2020-07-19 15:02:31 -07:00
parent 27e282b354
commit 479c899a8e
3 changed files with 10 additions and 11 deletions

View File

@ -437,12 +437,8 @@ export class Camera extends BasicSerializableObject {
return;
}
const middleMousePressed = event.button === 1 && event.buttons === 4;
this.touchPostMoveVelocity = new Vector(0, 0);
if (
event.button === 0 ||
(middleMousePressed && this.root.app.settings.getSetting("middleMouseScroll"))
) {
if (event.button === 0) {
this.combinedSingleTouchStartHandler(event.clientX, event.clientY);
} else if (event.button === 1) {
this.downPreHandler.dispatch(new Vector(event.clientX, event.clientY), enumMouseButton.middle);
@ -466,7 +462,10 @@ export class Camera extends BasicSerializableObject {
return;
}
if (event.button === 0) {
if (
(!this.root.app.settings.getSetting("middleMousePan") && event.button === 0) ||
(this.root.app.settings.getSetting("middleMousePan") && event.button === 1)
) {
this.combinedSingleTouchMoveHandler(event.clientX, event.clientY);
}

View File

@ -252,7 +252,7 @@ export const allApplicationSettings = [
new BoolSetting("compactBuildingInfo", categoryGame, (app, value) => {}),
new BoolSetting("disableCutDeleteWarnings", categoryGame, (app, value) => {}),
new BoolSetting("rotationByBuilding", categoryGame, (app, value) => {}),
new BoolSetting("middleMouseScroll", categoryGame, (app, value) => {}),
new BoolSetting("middleMousePan", categoryGame, (app, value) => {}),
];
export function getApplicationSettingById(id) {
@ -280,7 +280,7 @@ class SettingsStorage {
this.compactBuildingInfo = false;
this.disableCutDeleteWarnings = false;
this.rotationByBuilding = true;
this.middleMouseScroll = false;
this.middleMousePan = false;
this.enableColorBlindHelper = false;

View File

@ -774,10 +774,10 @@ settings:
description: >-
Disables the warning dialogs brought up when cutting/deleting more than 100 entities.
middleMouseScroll:
title: Middle mouse scroll
middleMousePan:
title: Pan camera with middle click
description: >-
Allows for scrolling with the middle mouse button in addition to left click.
Click with the middle mouse button instead of left click to pan the camera. Allows panning camera while a building is selected.
keybindings:
title: Keybindings