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
dff95fc7
Commit
dff95fc7
authored
Dec 04, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow for mutators with no quarks.
parent
96e130d1
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
18 deletions
+31
-18
blockly_compressed.js
blockly_compressed.js
+7
-7
core/mutator.js
core/mutator.js
+24
-11
No files found.
blockly_compressed.js
View file @
dff95fc7
This diff is collapsed.
Click to expand it.
core/mutator.js
View file @
dff95fc7
...
@@ -93,10 +93,14 @@ Blockly.Mutator.prototype.createEditor_ = function() {
...
@@ -93,10 +93,14 @@ Blockly.Mutator.prototype.createEditor_ = function() {
{
'
x
'
:
Blockly
.
Bubble
.
BORDER_WIDTH
,
'
y
'
:
Blockly
.
Bubble
.
BORDER_WIDTH
},
{
'
x
'
:
Blockly
.
Bubble
.
BORDER_WIDTH
,
'
y
'
:
Blockly
.
Bubble
.
BORDER_WIDTH
},
null
);
null
);
// Convert the list of names into a list of XML objects for the flyout.
// Convert the list of names into a list of XML objects for the flyout.
if
(
this
.
quarkNames_
.
length
)
{
var
quarkXml
=
goog
.
dom
.
createDom
(
'
xml
'
);
var
quarkXml
=
goog
.
dom
.
createDom
(
'
xml
'
);
for
(
var
i
=
0
,
quarkName
;
quarkName
=
this
.
quarkNames_
[
i
];
i
++
)
{
for
(
var
i
=
0
,
quarkName
;
quarkName
=
this
.
quarkNames_
[
i
];
i
++
)
{
quarkXml
.
appendChild
(
goog
.
dom
.
createDom
(
'
block
'
,
{
'
type
'
:
quarkName
}));
quarkXml
.
appendChild
(
goog
.
dom
.
createDom
(
'
block
'
,
{
'
type
'
:
quarkName
}));
}
}
}
else
{
var
quarkXml
=
null
;
}
var
mutator
=
this
;
var
mutator
=
this
;
var
workspaceOptions
=
{
var
workspaceOptions
=
{
languageTree
:
quarkXml
,
languageTree
:
quarkXml
,
...
@@ -138,15 +142,17 @@ Blockly.Mutator.prototype.updateEditable = function() {
...
@@ -138,15 +142,17 @@ Blockly.Mutator.prototype.updateEditable = function() {
Blockly
.
Mutator
.
prototype
.
resizeBubble_
=
function
()
{
Blockly
.
Mutator
.
prototype
.
resizeBubble_
=
function
()
{
var
doubleBorderWidth
=
2
*
Blockly
.
Bubble
.
BORDER_WIDTH
;
var
doubleBorderWidth
=
2
*
Blockly
.
Bubble
.
BORDER_WIDTH
;
var
workspaceSize
=
this
.
workspace_
.
getCanvas
().
getBBox
();
var
workspaceSize
=
this
.
workspace_
.
getCanvas
().
getBBox
();
var
flyoutMetrics
=
this
.
workspace_
.
flyout_
.
getMetrics_
();
var
width
;
var
width
;
if
(
this
.
block_
.
RTL
)
{
if
(
this
.
block_
.
RTL
)
{
width
=
-
workspaceSize
.
x
;
width
=
-
workspaceSize
.
x
;
}
else
{
}
else
{
width
=
workspaceSize
.
width
+
workspaceSize
.
x
;
width
=
workspaceSize
.
width
+
workspaceSize
.
x
;
}
}
var
height
=
Math
.
max
(
workspaceSize
.
height
+
doubleBorderWidth
*
3
,
var
height
=
workspaceSize
.
height
+
doubleBorderWidth
*
3
;
flyoutMetrics
.
contentHeight
+
20
);
if
(
this
.
workspace_
.
flyout_
)
{
var
flyoutMetrics
=
this
.
workspace_
.
flyout_
.
getMetrics_
();
height
=
Math
.
max
(
height
,
flyoutMetrics
.
contentHeight
+
20
);
}
width
+=
doubleBorderWidth
*
3
;
width
+=
doubleBorderWidth
*
3
;
// Only resize if the size difference is significant. Eliminates shuddering.
// Only resize if the size difference is significant. Eliminates shuddering.
if
(
Math
.
abs
(
this
.
workspaceWidth_
-
width
)
>
doubleBorderWidth
||
if
(
Math
.
abs
(
this
.
workspaceWidth_
-
width
)
>
doubleBorderWidth
||
...
@@ -184,9 +190,11 @@ Blockly.Mutator.prototype.setVisible = function(visible) {
...
@@ -184,9 +190,11 @@ Blockly.Mutator.prototype.setVisible = function(visible) {
this
.
createEditor_
(),
this
.
block_
.
svgPath_
,
this
.
createEditor_
(),
this
.
block_
.
svgPath_
,
this
.
iconX_
,
this
.
iconY_
,
null
,
null
);
this
.
iconX_
,
this
.
iconY_
,
null
,
null
);
var
thisObj
=
this
;
var
thisObj
=
this
;
var
tree
=
this
.
workspace_
.
options
.
languageTree
;
if
(
tree
)
{
this
.
workspace_
.
flyout_
.
init
(
this
.
workspace_
);
this
.
workspace_
.
flyout_
.
init
(
this
.
workspace_
);
this
.
workspace_
.
flyout_
.
show
(
this
.
workspace_
.
flyout_
.
show
(
tree
.
childNodes
);
this
.
workspace_
.
options
.
languageTree
.
childNodes
);
}
this
.
rootBlock_
=
this
.
block_
.
decompose
(
this
.
workspace_
);
this
.
rootBlock_
=
this
.
block_
.
decompose
(
this
.
workspace_
);
var
blocks
=
this
.
rootBlock_
.
getDescendants
();
var
blocks
=
this
.
rootBlock_
.
getDescendants
();
...
@@ -196,8 +204,13 @@ Blockly.Mutator.prototype.setVisible = function(visible) {
...
@@ -196,8 +204,13 @@ Blockly.Mutator.prototype.setVisible = function(visible) {
// The root block should not be dragable or deletable.
// The root block should not be dragable or deletable.
this
.
rootBlock_
.
setMovable
(
false
);
this
.
rootBlock_
.
setMovable
(
false
);
this
.
rootBlock_
.
setDeletable
(
false
);
this
.
rootBlock_
.
setDeletable
(
false
);
if
(
this
.
workspace_
.
flyout_
)
{
var
margin
=
this
.
workspace_
.
flyout_
.
CORNER_RADIUS
*
2
;
var
margin
=
this
.
workspace_
.
flyout_
.
CORNER_RADIUS
*
2
;
var
x
=
this
.
workspace_
.
flyout_
.
width_
+
margin
;
var
x
=
this
.
workspace_
.
flyout_
.
width_
+
margin
;
}
else
{
var
margin
=
16
;
var
x
=
margin
;
}
if
(
this
.
block_
.
RTL
)
{
if
(
this
.
block_
.
RTL
)
{
x
=
-
x
;
x
=
-
x
;
}
}
...
...
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