feat: 添加连音线快捷键

This commit is contained in:
2021-10-07 15:04:19 +08:00
parent c0bdf1fb63
commit ab51d8e565
2 changed files with 32 additions and 2 deletions
+27
View File
@@ -15,6 +15,7 @@ import {
createNotation,
isNote,
notations as N,
placeTie,
} from "../util/notation";
import {
cloneParagraph,
@@ -179,6 +180,32 @@ const handleKeyPress = wrappedAction((ev) => {
}
break;
}
case inputKey === "a" && !ctrl && !shift: {
if (!state.tieSourceKey) {
state.tieSourceKey = notation.key;
} else if (state.tieSourceKey === notation.key) {
state.tieSourceKey = null;
} else {
placeTie(notation);
}
break;
}
case inputKey === "a" && !ctrl && shift: {
if (notation.tieTo) {
const { notation: tieDesc } = findParagraphAndNotation(
notation.tieTo
);
if (tieDesc) {
tieDesc.tieTo = null;
}
notation.tieTo = null;
break;
}
}
case inputKey === "!" && !ctrl: {
notation.breakUnderline = !notation.breakUnderline;
break;
}
case inputKey === "~" && !ctrl: {
if (notation.topDecorators.includes("~")) {
notation.topDecorators.splice(notation.topDecorators.indexOf("~"), 1);
+5 -2
View File
@@ -44,14 +44,17 @@ function HelpModal({ visible, onVisibleChange }) {
直接按键盘上相应的键即可输入到当前符号支持的音符符号有
<p>
<kbd className={Styles.kbd}>0~7</kbd>
<kbd className={Styles.kbd}>( )</kbd>
<kbd className={Styles.kbd}> ( )</kbd>
</p>
<h4>输入辅助元素</h4>
<ul className={Styles.list}>
<KeyboardDescItem kbd="a" desc="选择连音线起止符号" />
<KeyboardDescItem kbd="A" desc="删除连音线" />
<KeyboardDescItem kbd="|" desc="输入小节线" />
<KeyboardDescItem kbd="." desc="输入附点" />
<KeyboardDescItem kbd="~" desc="颤音符号" />
<KeyboardDescItem kbd="u / U" desc="增减时线" />
<KeyboardDescItem kbd="u / U" desc="增减增减时线" />
<KeyboardDescItem kbd="!" desc="打断增减时线" />
<KeyboardDescItem kbd="8 / *" desc="八度圆点" />
<KeyboardDescItem kbd="# / b" desc="音符升/降" />
</ul>