From 1e45608a914f6cc1530324d22c8868721f93ae41 Mon Sep 17 00:00:00 2001 From: netpro2k <netpro2k@gmail.com> Date: Mon, 22 Oct 2018 15:03:49 -0700 Subject: [PATCH] Allow using esc to drop pen/camera-tool --- .../userinput/bindings/keyboard-mouse-user.js | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/systems/userinput/bindings/keyboard-mouse-user.js b/src/systems/userinput/bindings/keyboard-mouse-user.js index cba87f13f..290738ee2 100644 --- a/src/systems/userinput/bindings/keyboard-mouse-user.js +++ b/src/systems/userinput/bindings/keyboard-mouse-user.js @@ -3,6 +3,27 @@ import { sets } from "../sets"; import { xforms } from "./xforms"; const wasd_vec2 = "/var/mouse-and-keyboard/wasd_vec2"; +const dropWithRMB = "/vars/mouse-and-keyboard/drop_with_RMB"; +const dropWithEsc = "/vars/mouse-and-keyboard/drop_with_esc"; + +const dropWithRMBorEscBindings = [ + { + src: { value: paths.device.mouse.buttonRight }, + dest: { value: dropWithRMB }, + xform: xforms.falling + }, + { + src: { value: paths.device.keyboard.key("Escape") }, + dest: { value: dropWithEsc }, + xform: xforms.falling + }, + { + src: [dropWithRMB, dropWithEsc], + dest: { value: paths.actions.cursor.drop }, + xform: xforms.any + } +]; + export const keyboardMouseUserBindings = { [sets.global]: [ { @@ -159,11 +180,6 @@ export const keyboardMouseUserBindings = { priority: 200, root: "lmb" }, - { - src: { value: paths.device.mouse.buttonRight }, - dest: { value: paths.actions.cursor.drop }, - xform: xforms.falling - }, { src: { bool: paths.device.keyboard.key("shift"), @@ -178,7 +194,8 @@ export const keyboardMouseUserBindings = { src: { value: "/var/cursorScalePenTipWheel" }, dest: { value: paths.actions.cursor.scalePenTip }, xform: xforms.scale(0.12) - } + }, + ...dropWithRMBorEscBindings ], [sets.cursorHoldingCamera]: [ @@ -193,11 +210,7 @@ export const keyboardMouseUserBindings = { priority: 200, root: "lmb" }, - { - src: { value: paths.device.mouse.buttonRight }, - dest: { value: paths.actions.cursor.drop }, - xform: xforms.falling - } + ...dropWithRMBorEscBindings ], [sets.cursorHoldingInteractable]: [ -- GitLab