mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Change keybinding for multi select to ctrl
This commit is contained in:
parent
bd89c2cc9e
commit
5a61d1813a
@ -25,6 +25,7 @@ export class InputDistributor {
|
|||||||
|
|
||||||
this.shiftIsDown = false;
|
this.shiftIsDown = false;
|
||||||
this.altIsDown = false;
|
this.altIsDown = false;
|
||||||
|
this.ctrlIsDown = false;
|
||||||
|
|
||||||
this.bindToEvents();
|
this.bindToEvents();
|
||||||
}
|
}
|
||||||
@ -175,6 +176,7 @@ export class InputDistributor {
|
|||||||
* Handles when the page got blurred
|
* Handles when the page got blurred
|
||||||
*/
|
*/
|
||||||
handleBlur() {
|
handleBlur() {
|
||||||
|
this.ctrlIsDown = false;
|
||||||
this.shiftIsDown = false;
|
this.shiftIsDown = false;
|
||||||
this.altIsDown = false;
|
this.altIsDown = false;
|
||||||
this.forwardToReceiver("pageBlur", {});
|
this.forwardToReceiver("pageBlur", {});
|
||||||
@ -188,6 +190,9 @@ export class InputDistributor {
|
|||||||
if (event.keyCode === 16) {
|
if (event.keyCode === 16) {
|
||||||
this.shiftIsDown = true;
|
this.shiftIsDown = true;
|
||||||
}
|
}
|
||||||
|
if (event.keyCode === 17) {
|
||||||
|
this.ctrlIsDown = true;
|
||||||
|
}
|
||||||
if (event.keyCode === 18) {
|
if (event.keyCode === 18) {
|
||||||
this.altIsDown = true;
|
this.altIsDown = true;
|
||||||
}
|
}
|
||||||
@ -229,6 +234,10 @@ export class InputDistributor {
|
|||||||
this.shiftIsDown = false;
|
this.shiftIsDown = false;
|
||||||
this.forwardToReceiver("shiftUp", {});
|
this.forwardToReceiver("shiftUp", {});
|
||||||
}
|
}
|
||||||
|
if (event.keyCode === 17) {
|
||||||
|
this.ctrlIsDown = false;
|
||||||
|
this.forwardToReceiver("ctrlUp", {});
|
||||||
|
}
|
||||||
if (event.keyCode === 18) {
|
if (event.keyCode === 18) {
|
||||||
this.altIsDown = false;
|
this.altIsDown = false;
|
||||||
this.forwardToReceiver("altUp", {});
|
this.forwardToReceiver("altUp", {});
|
||||||
|
@ -11,6 +11,7 @@ export class InputReceiver {
|
|||||||
this.pageBlur = new Signal();
|
this.pageBlur = new Signal();
|
||||||
this.shiftUp = new Signal();
|
this.shiftUp = new Signal();
|
||||||
this.altUp = new Signal();
|
this.altUp = new Signal();
|
||||||
|
this.ctrlUp = new Signal();
|
||||||
|
|
||||||
// Dispatched on destroy
|
// Dispatched on destroy
|
||||||
this.destroyed = new Signal();
|
this.destroyed = new Signal();
|
||||||
|
@ -28,8 +28,8 @@ export class HUDBuildingPlacer extends BaseHUDPart {
|
|||||||
this.fakeEntity = null;
|
this.fakeEntity = null;
|
||||||
|
|
||||||
const keyActionMapper = this.root.gameState.keyActionMapper;
|
const keyActionMapper = this.root.gameState.keyActionMapper;
|
||||||
keyActionMapper.getBinding("building_abort_placement").add(() => this.currentMetaBuilding.set(null));
|
keyActionMapper.getBinding("building_abort_placement").add(this.abortPlacement, this);
|
||||||
keyActionMapper.getBinding("back").add(() => this.currentMetaBuilding.set(null));
|
keyActionMapper.getBinding("back").add(this.abortPlacement, this);
|
||||||
|
|
||||||
keyActionMapper.getBinding("rotate_while_placing").add(this.tryRotate, this);
|
keyActionMapper.getBinding("rotate_while_placing").add(this.tryRotate, this);
|
||||||
|
|
||||||
@ -61,6 +61,13 @@ export class HUDBuildingPlacer extends BaseHUDPart {
|
|||||||
this.buildingDescription = makeDiv(this.element, null, ["description"], "");
|
this.buildingDescription = makeDiv(this.element, null, ["description"], "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abortPlacement() {
|
||||||
|
if (this.currentMetaBuilding.get()) {
|
||||||
|
this.currentMetaBuilding.set(null);
|
||||||
|
return STOP_PROPAGATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mouse down pre handler
|
* mouse down pre handler
|
||||||
* @param {Vector} pos
|
* @param {Vector} pos
|
||||||
|
@ -45,7 +45,7 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
|
|||||||
|
|
||||||
<div class="binding noPlacementOnly">
|
<div class="binding noPlacementOnly">
|
||||||
<code class="keybinding rightMouse"></code><i></i>
|
<code class="keybinding rightMouse"></code><i></i>
|
||||||
<code class="keybinding shift">ALT</code>+
|
<code class="keybinding shift">CTRL</code>+
|
||||||
<code class="keybinding leftMouse"></code>
|
<code class="keybinding leftMouse"></code>
|
||||||
<label>Delete</label>
|
<label>Delete</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -79,7 +79,7 @@ export class HUDMassSelector extends BaseHUDPart {
|
|||||||
* @param {Vector} pos
|
* @param {Vector} pos
|
||||||
*/
|
*/
|
||||||
onMouseDown(pos) {
|
onMouseDown(pos) {
|
||||||
if (!this.root.app.inputMgr.altIsDown) {
|
if (!this.root.app.inputMgr.ctrlIsDown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user