caret: Don't turn on animation repeatedly
This commit is contained in:
parent
3c1ab71fce
commit
119a60d498
@ -768,6 +768,13 @@ window._qutebrowser.caret = (function() {
|
|||||||
*/
|
*/
|
||||||
CaretBrowsing.needsFilterPrefix = null;
|
CaretBrowsing.needsFilterPrefix = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id returned by window.setInterval for our stopAnimation function, so
|
||||||
|
* we can cancel it when we call stopAnimation again.
|
||||||
|
* @type {number?}
|
||||||
|
*/
|
||||||
|
CaretBrowsing.animationFunctionId = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a node is a control that normally allows the user to interact
|
* Check if a node is a control that normally allows the user to interact
|
||||||
* with it using arrow keys. We won't override the arrow keys when such a
|
* with it using arrow keys. We won't override the arrow keys when such a
|
||||||
@ -1252,7 +1259,9 @@ window._qutebrowser.caret = (function() {
|
|||||||
CaretBrowsing.stopAnimation = function() {
|
CaretBrowsing.stopAnimation = function() {
|
||||||
if (CaretBrowsing.caretElement) {
|
if (CaretBrowsing.caretElement) {
|
||||||
CaretBrowsing.caretElement.style.animationIterationCount = 0;
|
CaretBrowsing.caretElement.style.animationIterationCount = 0;
|
||||||
window.setTimeout(() => {
|
window.clearTimeout(CaretBrowsing.animationFunctionId);
|
||||||
|
|
||||||
|
CaretBrowsing.animationFunctionId = window.setTimeout(() => {
|
||||||
CaretBrowsing.startAnimation();
|
CaretBrowsing.startAnimation();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user