mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Don’t update category menu selection during auto-scroll
This commit is contained in:
parent
2497dbb7be
commit
8c7adafeb8
1 changed files with 6 additions and 0 deletions
|
@ -566,6 +566,11 @@ Blockly.Flyout.prototype.recordCategoryScrollPositions_ = function() {
|
|||
* @package
|
||||
*/
|
||||
Blockly.Flyout.prototype.selectCategoryByScrollPosition = function(pos) {
|
||||
// If we are currently auto-scrolling, due to selecting a category by clicking on it,
|
||||
// do not update the category selection.
|
||||
if (this.scrollTarget) {
|
||||
return;
|
||||
}
|
||||
var workspacePos = pos / this.workspace_.scale;
|
||||
// Traverse the array of scroll positions in reverse, so we can select the furthest
|
||||
// category that the scroll position is beyond.
|
||||
|
@ -591,6 +596,7 @@ Blockly.Flyout.prototype.stepScrollAnimation = function() {
|
|||
var diff = this.scrollTarget - scrollPos;
|
||||
if (Math.abs(diff) < 1) {
|
||||
this.scrollbar_.set(this.scrollTarget);
|
||||
this.scrollTarget = null;
|
||||
return;
|
||||
}
|
||||
this.scrollbar_.set(scrollPos + diff * this.scrollAnimationFraction);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue