mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Add scrollAnimationFraction property
This commit is contained in:
parent
4d073063f7
commit
72e87db8d1
1 changed files with 9 additions and 1 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue