mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Merge pull request #23 from Dimava/master
Make ctrl/shift/alt keubindings changeable
This commit is contained in:
commit
19c770201f
@ -161,14 +161,14 @@ export class HUDBuildingPlacer extends BaseHUDPart {
|
|||||||
if (
|
if (
|
||||||
metaBuilding &&
|
metaBuilding &&
|
||||||
metaBuilding.getRotateAutomaticallyWhilePlacing(this.currentVariant.get()) &&
|
metaBuilding.getRotateAutomaticallyWhilePlacing(this.currentVariant.get()) &&
|
||||||
!this.root.app.inputMgr.ctrlIsDown
|
!this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placementDisableAutoOrientation).currentlyDown
|
||||||
) {
|
) {
|
||||||
const delta = newPos.sub(oldPos);
|
const delta = newPos.sub(oldPos);
|
||||||
const angleDeg = Math_degrees(delta.angle());
|
const angleDeg = Math_degrees(delta.angle());
|
||||||
this.currentBaseRotation = (Math.round(angleDeg / 90) * 90 + 360) % 360;
|
this.currentBaseRotation = (Math.round(angleDeg / 90) * 90 + 360) % 360;
|
||||||
|
|
||||||
// Holding alt inverts the placement
|
// Holding alt inverts the placement
|
||||||
if (this.root.app.inputMgr.altIsDown) {
|
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeInverse).currentlyDown) {
|
||||||
this.currentBaseRotation = (180 + this.currentBaseRotation) % 360;
|
this.currentBaseRotation = (180 + this.currentBaseRotation) % 360;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -467,13 +467,16 @@ export class HUDBuildingPlacer extends BaseHUDPart {
|
|||||||
) {
|
) {
|
||||||
// Succesfully placed
|
// Succesfully placed
|
||||||
|
|
||||||
if (metaBuilding.getFlipOrientationAfterPlacement() && !this.root.app.inputMgr.ctrlIsDown) {
|
if (
|
||||||
|
metaBuilding.getFlipOrientationAfterPlacement() &&
|
||||||
|
!this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placementDisableAutoOrientation).currentlyDown
|
||||||
|
) {
|
||||||
this.currentBaseRotation = (180 + this.currentBaseRotation) % 360;
|
this.currentBaseRotation = (180 + this.currentBaseRotation) % 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!metaBuilding.getStayInPlacementMode() &&
|
!metaBuilding.getStayInPlacementMode() &&
|
||||||
!this.root.app.inputMgr.shiftIsDown &&
|
!this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeMultiple).currentlyDown &&
|
||||||
!this.root.app.settings.getAllSettings().alwaysMultiplace
|
!this.root.app.settings.getAllSettings().alwaysMultiplace
|
||||||
) {
|
) {
|
||||||
// Stop placement
|
// Stop placement
|
||||||
|
@ -121,7 +121,7 @@ export class HUDMassSelector extends BaseHUDPart {
|
|||||||
* @param {enumMouseButton} mouseButton
|
* @param {enumMouseButton} mouseButton
|
||||||
*/
|
*/
|
||||||
onMouseDown(pos, mouseButton) {
|
onMouseDown(pos, mouseButton) {
|
||||||
if (!this.root.app.inputMgr.ctrlIsDown) {
|
if (!this.root.keyMapper.getBinding(KEYMAPPINGS.massSelect.massSelectStart).currentlyDown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ export class HUDMassSelector extends BaseHUDPart {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.root.app.inputMgr.shiftIsDown) {
|
if (!this.root.keyMapper.getBinding(KEYMAPPINGS.massSelect.massSelectSelectMultiple).currentlyDown) {
|
||||||
// Start new selection
|
// Start new selection
|
||||||
this.selectedUids = new Set();
|
this.selectedUids = new Set();
|
||||||
}
|
}
|
||||||
|
@ -58,16 +58,16 @@ export const KEYMAPPINGS = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
massSelect: {
|
massSelect: {
|
||||||
massSelectStart: { keyCode: 17, builtin: true }, // CTRL
|
massSelectStart: { keyCode: 17 }, // CTRL
|
||||||
massSelectSelectMultiple: { keyCode: 16, builtin: true }, // SHIFT
|
massSelectSelectMultiple: { keyCode: 16 }, // SHIFT
|
||||||
massSelectCopy: { keyCode: key("C") },
|
massSelectCopy: { keyCode: key("C") },
|
||||||
confirmMassDelete: { keyCode: key("X") },
|
confirmMassDelete: { keyCode: key("X") },
|
||||||
},
|
},
|
||||||
|
|
||||||
placementModifiers: {
|
placementModifiers: {
|
||||||
placementDisableAutoOrientation: { keyCode: 17, builtin: true }, // CTRL
|
placementDisableAutoOrientation: { keyCode: 17 }, // CTRL
|
||||||
placeMultiple: { keyCode: 16, builtin: true }, // SHIFT
|
placeMultiple: { keyCode: 16 }, // SHIFT
|
||||||
placeInverse: { keyCode: 18, builtin: true }, // ALT
|
placeInverse: { keyCode: 18 }, // ALT
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user