Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Meta key support for accumulation function #22

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/extensions/selectable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { BaseArea, BaseAreaPlugin } from '../base'

type Schemes = GetSchemes<BaseSchemes['Node'] & { selected?: boolean }, any>

Check warning on line 5 in src/extensions/selectable.ts

View workflow job for this annotation

GitHub Actions / ci / ci

Unexpected any. Specify a different type

Check warning on line 5 in src/extensions/selectable.ts

View workflow job for this annotation

GitHub Actions / ci / ci

Unexpected any. Specify a different type

/**
* Selector's accumulate function, activated when the ctrl key is pressed
Expand All @@ -11,10 +11,10 @@
let pressed = false

function keydown(e: KeyboardEvent) {
if (e.key === 'Control') pressed = true
if (e.key === 'Control' || e.key === 'Meta') pressed = true
}
function keyup(e: KeyboardEvent) {
if (e.key === 'Control') pressed = false
if (e.key === 'Control' || e.key === 'Meta') pressed = false
}

document.addEventListener('keydown', keydown)
Expand Down Expand Up @@ -109,7 +109,7 @@
* @listens pointermove
* @listens pointerup
*/
export function selectableNodes<T>(base: BaseAreaPlugin<Schemes, T>, core: Selectable, options: { accumulating: Accumulating }) {

Check warning on line 112 in src/extensions/selectable.ts

View workflow job for this annotation

GitHub Actions / ci / ci

This line has a length of 129. Maximum allowed is 120

Check warning on line 112 in src/extensions/selectable.ts

View workflow job for this annotation

GitHub Actions / ci / ci

This line has a length of 129. Maximum allowed is 120
let editor: null | NodeEditor<Schemes> = null
const area = base as BaseAreaPlugin<Schemes, BaseArea<Schemes>>
const getEditor = () => editor || (editor = area.parentScope<NodeEditor<Schemes>>(NodeEditor))
Expand Down
Loading