Handle auto-scrolling and highlighting list monitor index #5961
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
scratchfoundation/scratch-vm#2507 must be merged first
Resolves
GUI part for these issues:
Resolves scratchfoundation/scratch-vm#1385
Resolves scratchfoundation/scratch-vm#1386
Proposed Changes
Adds list index highlighting and list auto-scrolling feature (although the bugtracker says lack of auto-scrolling is a bug)
When a list monitor receives update to its
highlightItem
, it cancels the setTimeout (which i'll mention below), and does two things:highlightItems
which is a Map (not immutable) of number to setTimeout which unhighlights it after 500mshighlightItem
andhighlightItems
, which scrolls to added item (list-monitor-scroller L87)When highlighting $control-primary is used.
Note that we pass stringified version of highlightItems to List so that it re-renders - it's PureComponent and doesn't re-render when unhighlighting by itself.
Reason for Changes
compatibility with Scratch 2.0
Test Coverage
Attached a project sb3 - rename and open. click green flag, go to fullscreen, click the stage (not the stage monitor), try pressing arrow keys!
scrollable-list.sb3.zip