mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-02-23 16:31:20 +08:00
Keys to start and cancel GIF recording
This commit is contained in:
parent
dd0257e70c
commit
a61aa664b2
@ -589,6 +589,8 @@ const Screencam = {
|
||||
}, vars.interval)
|
||||
|
||||
vars.frame.classList.add('recording');
|
||||
|
||||
key_listener.delete();
|
||||
}
|
||||
async function endRecording(render) {
|
||||
if (!vars.recording) return;
|
||||
@ -616,6 +618,7 @@ const Screencam = {
|
||||
}
|
||||
function cancel() {
|
||||
vars.frame.remove();
|
||||
key_listener.delete();
|
||||
}
|
||||
function updateCrop() {
|
||||
if (!options.resolution) {
|
||||
@ -703,6 +706,19 @@ const Screencam = {
|
||||
});
|
||||
controls.append(record_button);
|
||||
|
||||
let key_listener = Blockbench.on('press_key', context => {
|
||||
if (Keybinds.extra.confirm.keybind.isTriggered(context.event)) {
|
||||
context.capture();
|
||||
startRecording();
|
||||
return;
|
||||
}
|
||||
if (Keybinds.extra.cancel.keybind.isTriggered(context.event)) {
|
||||
context.capture();
|
||||
vars.recording ? endRecording(false) : cancel();
|
||||
return;
|
||||
}
|
||||
})
|
||||
|
||||
let stop_button = Interface.createElement('div', {class: 'tool'}, Blockbench.getIconNode('stop'));
|
||||
stop_button.addEventListener('click', event => {
|
||||
vars.recording ? endRecording(true) : cancel();
|
||||
|
Loading…
Reference in New Issue
Block a user