From b109519cb5de9f3885680088505356b8d924a024 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Thu, 25 Jul 2019 00:12:10 +0300 Subject: [PATCH] add to selection --- .../simulationRenderer/classes/SimulationRenderer.ts | 8 ++++++-- src/modules/simulationRenderer/constants.ts | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/simulationRenderer/classes/SimulationRenderer.ts b/src/modules/simulationRenderer/classes/SimulationRenderer.ts index 3c65033..a44ae22 100644 --- a/src/modules/simulationRenderer/classes/SimulationRenderer.ts +++ b/src/modules/simulationRenderer/classes/SimulationRenderer.ts @@ -9,7 +9,11 @@ import { import { vector2 } from '../../../common/math/types/vector2' import { relativeTo, add, invert } from '../../vector2/helpers/basic' import { SimulationRendererOptions } from '../types/SimulationRendererOptions' -import { defaultSimulationRendererOptions, mouseButtons } from '../constants' +import { + defaultSimulationRendererOptions, + mouseButtons, + shiftInput +} from '../constants' import { getPinPosition } from '../helpers/pinPosition' import { pointInCircle } from '../../../common/math/helpers/pointInCircle' import { SelectedPins } from '../types/SelectedPins' @@ -177,7 +181,7 @@ export class SimulationRenderer { } } - if (event.button === mouseButtons.unselect) { + if (!shiftInput.value && event.button === mouseButtons.unselect) { this.clearSelection() } diff --git a/src/modules/simulationRenderer/constants.ts b/src/modules/simulationRenderer/constants.ts index 03b9857..6645f8c 100644 --- a/src/modules/simulationRenderer/constants.ts +++ b/src/modules/simulationRenderer/constants.ts @@ -1,6 +1,7 @@ import { SimulationRendererOptions } from './types/SimulationRendererOptions' import { vector2 } from '../../common/math/classes/Transform' import { mouseButton } from '../core/types/mouseButton' +import { KeyboardInput } from '../keybindings/classes/KeyboardInput' export const defaultSimulationRendererOptions: SimulationRendererOptions = { dnd: { @@ -46,3 +47,5 @@ export const mouseButtons: Record< select: 0, unselect: 0 } + +export const shiftInput = new KeyboardInput('shift')