音量大小控制

This commit is contained in:
zilong
2021-11-07 17:54:53 +08:00
parent 70cb1b3e06
commit 310cf5efad
7 changed files with 235 additions and 28 deletions

View File

@@ -10,7 +10,7 @@ export default function useHotkey(){
"enter,ctrl+enter,⌘+enter",
].join(","),
throttle((e, h) => {
switch (h.key) {
switch (h.key) {
// space,ctrl+p,⌘+p
case "space":
case "ctrl+p":
@@ -26,6 +26,15 @@ export default function useHotkey(){
case "⌘+right":
pubsub.publish("zp.next");
break;
// ctrl+up,⌘+up,ctrl+down,⌘+down
case "ctrl+up":
case "⌘+up":
pubsub.publish("zp.setVolume",{step: 5});
break;
case "ctrl+down":
case "⌘+down":
pubsub.publish("zp.setVolume",{step: -5});
break;
// enter,ctrl+enter,⌘+enter
case "enter":
case "ctrl+enter":
@@ -36,4 +45,23 @@ export default function useHotkey(){
e.preventDefault();
}, 500)
);
hotkeys(
[
"ctrl+up,⌘+up,ctrl+down,⌘+down",
].join(","),
throttle((e, h) => {
switch (h.key) {
// ctrl+up,⌘+up,ctrl+down,⌘+down
case "ctrl+up":
case "⌘+up":
pubsub.publish("zp.setVolume",{step: 5});
break;
case "ctrl+down":
case "⌘+down":
pubsub.publish("zp.setVolume",{step: -5});
break;
}
e.preventDefault();
}, 50)
);
};