Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
7c1d720e
Unverified
Commit
7c1d720e
authored
6 years ago
by
Paul Kaplan
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #4485 from towerofnix/sort-of-variables
Sort variable options in "of" block
parents
b29862fc
9166cb12
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/blocks.js
+8
-0
8 additions, 0 deletions
src/lib/blocks.js
with
8 additions
and
0 deletions
src/lib/blocks.js
+
8
−
0
View file @
7c1d720e
...
...
@@ -245,8 +245,15 @@ export default function (vm) {
// The block was in the flyout so look up future block info there.
lookupBlocks
=
vm
.
runtime
.
flyoutBlocks
;
}
const
sort
=
function
(
options
)
{
options
.
sort
((
str1
,
str2
)
=>
str1
.
localeCompare
(
str2
,
[],
{
sensitivity
:
'
base
'
,
numeric
:
true
}));
};
// Get all the stage variables (no lists) so we can add them to menu when the stage is selected.
const
stageVariableOptions
=
vm
.
runtime
.
getTargetForStage
().
getAllVariableNamesInScopeByType
(
''
);
sort
(
stageVariableOptions
);
const
stageVariableMenuItems
=
stageVariableOptions
.
map
(
variable
=>
[
variable
,
variable
]);
if
(
sensingOfBlock
.
inputs
.
OBJECT
.
shadow
!==
sensingOfBlock
.
inputs
.
OBJECT
.
block
)
{
// There's a block dropped on top of the menu. It'd be nice to evaluate it and
...
...
@@ -265,6 +272,7 @@ export default function (vm) {
// The target should exist, but there are ways for it not to (e.g. #4203).
if
(
target
)
{
spriteVariableOptions
=
target
.
getAllVariableNamesInScopeByType
(
''
,
true
);
sort
(
spriteVariableOptions
);
}
const
spriteVariableMenuItems
=
spriteVariableOptions
.
map
(
variable
=>
[
variable
,
variable
]);
return
spriteOptions
.
concat
(
spriteVariableMenuItems
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment