Adding feature - Show the controller briefly when adjusting speed and the controller is set to hidden. (#538)

Adding new feature: when the controller is hidden and the user changes rate, show the controller briefly. A new action called `blink` is added, and is called when the rate changes. Then if the controller is hidden, remove `vsc-hidden` and add it back after `value` millisecends.
This commit is contained in:
Yang
2019-11-14 01:55:25 -05:00
committed by Ilya Grigorik
parent ec9f3f6d20
commit ac53d3ea2b

View File

@@ -172,6 +172,8 @@
chrome.storage.sync.set({'lastSpeed': speed}, function() {
console.log('Speed setting saved: ' + speed);
});
// show the controller for 1000ms if it's hidden.
runAction('blink', document, null, null);
}
}.bind(this));
@@ -494,6 +496,16 @@
} else if (action === 'display') {
controller.classList.add('vsc-manual');
controller.classList.toggle('vsc-hidden');
} else if (action === 'blink') {
// if vsc is hidden, show it briefly to give the use visual feedback that the action is excuted.
if(controller.classList.contains('vsc-hidden') || controller.blinkTimeOut !== undefined){
clearTimeout(controller.blinkTimeOut);
controller.classList.remove('vsc-hidden');
controller.blinkTimeOut = setTimeout(()=>{
controller.classList.add('vsc-hidden');
controller.blinkTimeOut = undefined;
}, value ? value : 1000);
}
} else if (action === 'drag') {
handleDrag(v, controller, e);
} else if (action === 'fast') {