Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
b36a88f4
Commit
b36a88f4
authored
Feb 10, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bad rendering of collapsed function calls.
parent
d05177e1
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
23 deletions
+34
-23
blocks/procedures.js
blocks/procedures.js
+25
-14
blocks_compressed.js
blocks_compressed.js
+9
-9
No files found.
blocks/procedures.js
View file @
b36a88f4
...
@@ -273,7 +273,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
...
@@ -273,7 +273,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
if
(
change
)
{
if
(
change
)
{
this
.
updateParams_
();
this
.
updateParams_
();
// Update the mutator's variables if the mutator is open.
// Update the mutator's variables if the mutator is open.
if
(
this
.
mutator
.
isVisible
_
())
{
if
(
this
.
mutator
.
isVisible
())
{
var
blocks
=
this
.
mutator
.
workspace_
.
getAllBlocks
();
var
blocks
=
this
.
mutator
.
workspace_
.
getAllBlocks
();
for
(
var
i
=
0
,
block
;
block
=
blocks
[
i
];
i
++
)
{
for
(
var
i
=
0
,
block
;
block
=
blocks
[
i
];
i
++
)
{
if
(
block
.
type
==
'
procedures_mutatorarg
'
&&
if
(
block
.
type
==
'
procedures_mutatorarg
'
&&
...
@@ -428,10 +428,9 @@ Blockly.Blocks['procedures_callnoreturn'] = {
...
@@ -428,10 +428,9 @@ Blockly.Blocks['procedures_callnoreturn'] = {
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_CALLNORETURN_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_CALLNORETURN_HELPURL
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
(
'
TOPROW
'
)
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALLNORETURN_CALL
)
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALLNORETURN_CALL
)
.
appendField
(
''
,
'
NAME
'
)
.
appendField
(
''
,
'
NAME
'
);
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALL_BEFORE_PARAMS
,
'
WITH
'
);
this
.
setPreviousStatement
(
true
);
this
.
setPreviousStatement
(
true
);
this
.
setNextStatement
(
true
);
this
.
setNextStatement
(
true
);
// Tooltip is set in domToMutation.
// Tooltip is set in domToMutation.
...
@@ -488,6 +487,12 @@ Blockly.Blocks['procedures_callnoreturn'] = {
...
@@ -488,6 +487,12 @@ Blockly.Blocks['procedures_callnoreturn'] = {
this
.
quarkArguments_
=
null
;
this
.
quarkArguments_
=
null
;
return
;
return
;
}
}
if
(
goog
.
array
.
equals
(
this
.
arguments_
,
paramNames
))
{
// No change.
this
.
quarkArguments_
=
paramIds
;
return
;
}
this
.
setCollapsed
(
false
);
if
(
paramIds
.
length
!=
paramNames
.
length
)
{
if
(
paramIds
.
length
!=
paramNames
.
length
)
{
throw
'
Error: paramNames and paramIds must be the same length.
'
;
throw
'
Error: paramNames and paramIds must be the same length.
'
;
}
}
...
@@ -536,14 +541,21 @@ Blockly.Blocks['procedures_callnoreturn'] = {
...
@@ -536,14 +541,21 @@ Blockly.Blocks['procedures_callnoreturn'] = {
}
}
}
}
}
}
if
(
savedRendered
)
{
input
.
init
();
input
.
init
();
}
}
}
// Add 'with:' if there are parameters.
// Add 'with:' if there are parameters.
var
withField
=
this
.
getField_
(
'
WITH
'
);
var
input
=
this
.
getInput
(
'
TOPROW
'
);
if
(
withField
)
{
if
(
input
)
{
withField
.
setVisible
(
!!
this
.
arguments_
.
length
);
if
(
this
.
arguments_
.
length
)
{
if
(
!
this
.
getField_
(
'
WITH
'
))
{
input
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALL_BEFORE_PARAMS
,
'
WITH
'
);
input
.
init
();
}
}
else
{
if
(
this
.
getField_
(
'
WITH
'
))
{
input
.
removeField
(
'
WITH
'
);
}
}
}
}
// Restore rendering and show the changes.
// Restore rendering and show the changes.
this
.
rendered
=
savedRendered
;
this
.
rendered
=
savedRendered
;
...
@@ -578,7 +590,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
...
@@ -578,7 +590,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
(
this
.
outputConnection
?
Blockly
.
Msg
.
PROCEDURES_CALLRETURN_TOOLTIP
:
(
this
.
outputConnection
?
Blockly
.
Msg
.
PROCEDURES_CALLRETURN_TOOLTIP
:
Blockly
.
Msg
.
PROCEDURES_CALLNORETURN_TOOLTIP
).
replace
(
'
%1
'
,
name
));
Blockly
.
Msg
.
PROCEDURES_CALLNORETURN_TOOLTIP
).
replace
(
'
%1
'
,
name
));
var
def
=
Blockly
.
Procedures
.
getDefinition
(
name
,
this
.
workspace
);
var
def
=
Blockly
.
Procedures
.
getDefinition
(
name
,
this
.
workspace
);
if
(
def
&&
def
.
mutator
.
isVisible
())
{
if
(
def
&&
def
.
mutator
&&
def
.
mutator
.
isVisible
())
{
// Initialize caller with the mutator's IDs.
// Initialize caller with the mutator's IDs.
this
.
setProcedureParameters
(
def
.
arguments_
,
def
.
paramIds_
);
this
.
setProcedureParameters
(
def
.
arguments_
,
def
.
paramIds_
);
}
else
{
}
else
{
...
@@ -634,10 +646,9 @@ Blockly.Blocks['procedures_callreturn'] = {
...
@@ -634,10 +646,9 @@ Blockly.Blocks['procedures_callreturn'] = {
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_CALLRETURN_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_CALLRETURN_HELPURL
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
(
'
TOPROW
'
)
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALLRETURN_CALL
)
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALLRETURN_CALL
)
.
appendField
(
''
,
'
NAME
'
)
.
appendField
(
''
,
'
NAME
'
);
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALL_BEFORE_PARAMS
,
'
WITH
'
);
this
.
setOutput
(
true
);
this
.
setOutput
(
true
);
// Tooltip is set in domToMutation.
// Tooltip is set in domToMutation.
this
.
arguments_
=
[];
this
.
arguments_
=
[];
...
...
blocks_compressed.js
View file @
b36a88f4
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment