Changed option keyboard shortcuts to use command instead

This commit is contained in:
patben8 committed 2026-10-15 16:36:10 +02:00
1 parent 32cfb034e2
commit 16c3552be6
9 files changed
+72 -56

No files matched your search

+4 -5
View File
@@ -2,6 +2,7 @@ import { useEffect, useRef } from 'react'
import type { CuePoint } from '../api'
import type { BeatGrid } from '../lib/beatgrid'
import { Icon } from '../lib/icons'
import { hasMod, MOD_NAME } from '../lib/modKey'
import { drawBeatgrid, drawCuePoint, drawCues, drawLoop, drawLoopIn, drawPlayhead } from '../lib/cues'
import { laneScales, makeSpans, paintRaw, rawSpans, tintAt, type RawWave } from '../lib/rawWave'
import { paintLane, paintWave, type WaveColumn } from '../lib/waveform'
@@ -38,7 +39,7 @@ interface Props {
onScratchEnd: (t: number) => void
/** A stem track: one lane per stem instead of the three-band mix view. */
lanes?: StemLane[] | null
/** Click = mute toggle; Alt/Option-click = solo (mute all the others). */
/** Click = mute toggle; Cmd/Ctrl-click = solo (mute all the others). */
onStemToggle?: (index: number, solo: boolean) => void
}
@@ -56,8 +57,6 @@ export interface StemLane {
shortcut: string
}
const ALT = typeof navigator !== 'undefined' && /Mac/.test(navigator.platform) ? 'Option' : 'Alt'
const DRAG_THRESHOLD = 3 // px before a press becomes a scratch (vs a click-seek)
export const MIN_SEC = 0.25 // most zoomed-in (seconds across the view): a kick's attack spans dozens of px
@@ -277,8 +276,8 @@ export function MainWaveform({
<div key={k} className="flex flex-1 items-center">
<button
onPointerDown={(e) => e.stopPropagation()}
onClick={(e) => onStemToggle?.(k, e.altKey)}
title={`${lane.name} — click to mute, ${ALT}-click to mute all the others (${lane.shortcut})`}
onClick={(e) => onStemToggle?.(k, hasMod(e))}
title={`${lane.name} — click to mute, ${MOD_NAME}-click to mute all the others (${lane.shortcut})`}
aria-pressed={lane.audible}
className={`flex h-5 min-w-5 items-center justify-center rounded-md px-1 font-mono text-[10px] font-semibold backdrop-blur-md transition-opacity ${
lane.audible ? '' : 'opacity-40'
+3 -3
View File
@@ -55,7 +55,7 @@ export function ShortcutsDialog({ onClose }: Props) {
const [pressed, setPressed] = useState<string | null>(null)
const [query, setQuery] = useState('')
const [areas, setAreas] = useState<ReadonlySet<Area>>(new Set(ALL_AREAS))
const layer: Layer = held.has('mod') ? 'mod' : held.has('alt') ? 'alt' : held.has('shift') ? 'shift' : sticky
const layer: Layer = held.has('mod') ? 'mod' : held.has('shift') ? 'shift' : sticky
const q = query.trim().toLowerCase()
// ---- fit: one key unit from the width the map has ----
@@ -430,8 +430,8 @@ function Caption({
<>
<span className="text-text">Point at a key, or press it, to see what it does.</span>
<span className="text-xs">
Hold <Kbd>{MODIFIER_KEY.shift}</Kbd> <Kbd>{MODIFIER_KEY.mod}</Kbd> or <Kbd>{MODIFIER_KEY.alt}</Kbd>, or pick
one above, to see what each modifier changes.
Hold <Kbd>{MODIFIER_KEY.shift}</Kbd> or <Kbd>{MODIFIER_KEY.mod}</Kbd>, or pick one above, to see what each
modifier changes.
</span>
<span className="text-xs">
{padRange(slots)} are this library's {slots} hotcue pads; Q W E R are the stems of a stem track.
+8 -8
View File
@@ -114,9 +114,9 @@ interface RowActions {
onCancelDraft: () => void
/** Whether a drag of tracks (or of files from the OS) may drop on this playlist. */
acceptsTracks: (node: PlaylistNode, p: TracksOrFiles) => boolean
/** Tracks dropped on a playlist; `alt` (Option) moves them out of the
/** Tracks dropped on a playlist; `mod` (Cmd/Ctrl) moves them out of the
* playlist they came from. */
onDropTracks: (node: PlaylistNode, p: TracksOrFiles, alt: boolean) => void
onDropTracks: (node: PlaylistNode, p: TracksOrFiles, mod: boolean) => void
/** Whether a node may be dragged elsewhere in the tree. */
canMove: (node: PlaylistNode) => boolean
/** A node dropped in the tree: `index` among `parentId`'s children,
@@ -227,8 +227,8 @@ function NodeRow({
// drop TARGET for tracks. Whether it takes them is the node's own
// `can_add_tracks` plus the library being writable, decided by the sidebar.
const startDrag = usePressToDrag(() => (renaming ? null : { kind: 'node', node, parentId }))
const moves = (p: DragPayload, alt: boolean) =>
p.kind === 'tracks' && alt && !!p.fromPlaylist && p.fromPlaylist !== node.id
const moves = (p: DragPayload, mod: boolean) =>
p.kind === 'tracks' && mod && !!p.fromPlaylist && p.fromPlaylist !== node.id
// A node held over this row: which zone, and where that puts it. Never into
// itself or anything nested in it; a drop that would leave it exactly where
@@ -267,14 +267,14 @@ function NodeRow({
if (h.zone === 'tracks') {
if (p.kind === 'tracks' && p.origin === 'device') return `Import into ${node.name}…`
if ((p.kind === 'tracks' && p.origin === 'folder') || p.kind === 'files') return `Add to ${node.name}…`
return `${moves(p, at.alt) ? 'Move' : 'Add'} to ${node.name}`
return `${moves(p, at.mod) ? 'Move' : 'Add'} to ${node.name}`
}
if (h.zone === 'peek') return null
return h.zone === 'into' || h.zone === 'first' ? `Move into ${node.name}` : `Move ${h.zone} ${node.name}`
},
onDrop: (p, h, at) => {
if (p.kind !== 'node') {
if (h.zone === 'tracks') actions.onDropTracks(node, p, at.alt)
if (h.zone === 'tracks') actions.onDropTracks(node, p, at.mod)
} else if ('parentId' in h) {
actions.onMoveNode(p.node, h.parentId, h.index, h.zone === 'into' && !expanded ? node : null)
}
@@ -678,7 +678,7 @@ export function Sidebar({
onError((e as Error).message)
}
},
onDropTracks: async (node, p, alt) => {
onDropTracks: async (node, p, mod) => {
if (p.kind === 'files') {
onAddForeign('dropped', p.paths, { kind: 'playlist', id: node.id, name: node.name })
return
@@ -693,7 +693,7 @@ export function Sidebar({
playlist: node,
ids: p.ids,
duplicatesAllowed: caps.playlists.duplicates,
moveFrom: alt ? p.fromPlaylist : undefined,
moveFrom: mod ? p.fromPlaylist : undefined,
})
if (msg) onDone(msg)
} catch (e) {
+6 -3
View File
@@ -31,6 +31,7 @@ import {
import { CSS } from '@dnd-kit/utilities'
import type { Track, TrackOrigin } from '../api'
import { beginDrag, useDragPayload, useDropTarget } from '../lib/drag'
import { hasMod } from '../lib/modKey'
import { TRACK_COLUMNS } from '../lib/trackColumns'
/** Fields this platform can persist, for the table's per-cell edit gating.
@@ -73,7 +74,7 @@ interface Props {
* active: reordering a partial or re-sorted list would lose the real order. */
reorder?: { enabled: boolean; onReorder: (ids: string[]) => void }
/** Where dragged rows come from: whose ids they are, and the editable
* playlist they leave on an Option-drag (move). Defaults to the collection. */
* playlist they leave on a Cmd/Ctrl-drag (move). Defaults to the collection. */
dragFrom?: { origin: TrackOrigin; playlistId?: string }
/** Delete/Backspace removes the selected tracks from this view. */
onRemove?: (ids: string[]) => void
@@ -432,7 +433,7 @@ export function TrackTable({
fromPlaylist: from?.playlistId,
source: tableKey,
},
{ x: e.clientX, y: e.clientY, alt: e.altKey },
{ x: e.clientX, y: e.clientY, mod: hasMod(e) },
)
}
const release = () => (pressRef.current = null)
@@ -580,7 +581,9 @@ export function TrackTable({
if (selection && (e.shiftKey || e.metaKey || e.ctrlKey)) e.preventDefault()
}}
onPointerDown={(e) => {
if (e.button !== 0 || e.shiftKey || e.metaKey || e.ctrlKey) return
// Cmd/Ctrl arms a drag too (it MOVES the tracks); without
// movement it stays a Cmd/Ctrl-click, which toggles the row.
if (e.button !== 0 || e.shiftKey || (!hasMod(e) && (e.metaKey || e.ctrlKey))) return
// Not from a control inside the row (play, stars, an edit field).
if ((e.target as HTMLElement).closest('button, input, textarea, select, a')) return
pressRef.current = { x: e.clientX, y: e.clientY, index: vr.index }