Change keybinding for multi select to ctrl

pull/33/head
Tobias Springer 4 years ago
parent bd89c2cc9e
commit 5a61d1813a

@ -25,6 +25,7 @@ export class InputDistributor {
this.shiftIsDown = false;
this.altIsDown = false;
this.ctrlIsDown = false;
this.bindToEvents();
}
@ -175,6 +176,7 @@ export class InputDistributor {
* Handles when the page got blurred
*/
handleBlur() {
this.ctrlIsDown = false;
this.shiftIsDown = false;
this.altIsDown = false;
this.forwardToReceiver("pageBlur", {});
@ -188,6 +190,9 @@ export class InputDistributor {
if (event.keyCode === 16) {
this.shiftIsDown = true;
}
if (event.keyCode === 17) {
this.ctrlIsDown = true;
}
if (event.keyCode === 18) {
this.altIsDown = true;
}
@ -229,6 +234,10 @@ export class InputDistributor {
this.shiftIsDown = false;
this.forwardToReceiver("shiftUp", {});
}
if (event.keyCode === 17) {
this.ctrlIsDown = false;
this.forwardToReceiver("ctrlUp", {});
}
if (event.keyCode === 18) {
this.altIsDown = false;
this.forwardToReceiver("altUp", {});

@ -11,6 +11,7 @@ export class InputReceiver {
this.pageBlur = new Signal();
this.shiftUp = new Signal();
this.altUp = new Signal();
this.ctrlUp = new Signal();
// Dispatched on destroy
this.destroyed = new Signal();

@ -28,8 +28,8 @@ export class HUDBuildingPlacer extends BaseHUDPart {
this.fakeEntity = null;
const keyActionMapper = this.root.gameState.keyActionMapper;
keyActionMapper.getBinding("building_abort_placement").add(() => this.currentMetaBuilding.set(null));
keyActionMapper.getBinding("back").add(() => this.currentMetaBuilding.set(null));
keyActionMapper.getBinding("building_abort_placement").add(this.abortPlacement, this);
keyActionMapper.getBinding("back").add(this.abortPlacement, 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"], "");
}
abortPlacement() {
if (this.currentMetaBuilding.get()) {
this.currentMetaBuilding.set(null);
return STOP_PROPAGATION;
}
}
/**
* mouse down pre handler
* @param {Vector} pos

@ -45,7 +45,7 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
<div class="binding noPlacementOnly">
<code class="keybinding rightMouse"></code><i></i>
<code class="keybinding shift">ALT</code>+
<code class="keybinding shift">CTRL</code>+
<code class="keybinding leftMouse"></code>
<label>Delete</label>
</div>

@ -79,7 +79,7 @@ export class HUDMassSelector extends BaseHUDPart {
* @param {Vector} pos
*/
onMouseDown(pos) {
if (!this.root.app.inputMgr.altIsDown) {
if (!this.root.app.inputMgr.ctrlIsDown) {
return;
}

Loading…
Cancel
Save