Add scrollAnimationFraction property

This commit is contained in:
Eric Rosenbaum 2017-09-18 15:21:41 -04:00
parent 4d073063f7
commit 72e87db8d1

View file

@ -228,6 +228,14 @@ Blockly.Flyout.prototype.verticalOffset_ = 0;
*/
Blockly.Flyout.prototype.dragAngleRange_ = 70;
/**
* The fraction of the distance to the scroll target to move the flyout on
* each animation frame, when auto-scrolling. Values closer to 1.0 will make
* the scroll animation complete faster. Use 1.0 for no animation.
* @type {number}
*/
Blockly.Flyout.prototype.scrollAnimationFraction = 0.3;
/**
* Creates the flyout's DOM. Only needs to be called once. The flyout can
* either exist as its own svg element or be a g element nested inside a
@ -560,7 +568,7 @@ Blockly.Flyout.prototype.stepScrollAnimation = function() {
this.scrollbar_.set(this.scrollTarget);
return;
}
this.scrollbar_.set(scrollPos + diff * 0.3);
this.scrollbar_.set(scrollPos + diff * this.scrollAnimationFraction);
// Polyfilled by goog.dom.animationFrame.polyfill
requestAnimationFrame(this.stepScrollAnimation.bind(this));