Add drag-select to Multi dropdowns#128
Open
corradedied wants to merge 2 commits into
Open
Conversation
Added drag selection functionality to dropdown buttons.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Selecting many values in a long Multi dropdown (e.g. a player list) required clicking each item individually. Holding left click and dragging over items now selects or deselects them in one gesture.
Three upvalues (
DragSelecting,DragSelectState,DragInputEndedConn) and aStopDragSelecthelper are declared outsideBuildDropdownListso they survive list rebuilds.BuildDropdownListcallsStopDragSelectat the top to cancel any in-progress drag before destroying and recreating buttons.For each non-disabled item in a Multi dropdown:
InputBegan(MB1) starts the drag, locks the toggle direction to the opposite of the pressed item's current state, applies it immediately, and attaches aUserInputService.InputEndedlistener that fires callbacks once and clears drag state on mouse release.MouseEnterextends the drag to each item the cursor passes over, applying the locked direction and respectingAllowNull.MouseButton1Clickreturns early whenDragSelectingis true to suppress the synthetic click Roblox fires afterInputEnded, preventing the first item from being double-toggled.Callbacks fire once at the end of the gesture rather than per item to avoid hammering

Callback/Changedduring a fast drag. Single-select dropdowns are unaffected.