add to selection

This commit is contained in:
Matei Adriel 2019-07-25 00:12:10 +03:00
parent 48b967ead8
commit b109519cb5
2 changed files with 9 additions and 2 deletions

View file

@ -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()
}

View file

@ -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')