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
aa5afd18
Commit
aa5afd18
authored
Jan 26, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve rendering speed.
parent
3e893da2
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
14 deletions
+43
-14
blockly_compressed.js
blockly_compressed.js
+9
-8
core/block.js
core/block.js
+11
-0
core/connection.js
core/connection.js
+18
-5
core/xml.js
core/xml.js
+4
-0
tests/playground.html
tests/playground.html
+1
-1
No files found.
blockly_compressed.js
View file @
aa5afd18
This diff is collapsed.
Click to expand it.
core/block.js
View file @
aa5afd18
...
...
@@ -512,6 +512,17 @@ Blockly.Block.prototype.setEditable = function(editable) {
}
};
/**
* Set whether the connections are hidden (not tracked in a database) or not.
* @param {boolean} hidden True if connections are hidden.
*/
Blockly
.
Block
.
prototype
.
setConnectionsHidden
=
function
(
hidden
)
{
var
myConnections
=
this
.
getConnections_
(
true
);
for
(
var
i
=
0
,
connection
;
connection
=
myConnections
[
i
];
i
++
)
{
connection
.
setHidden
(
hidden
);
}
};
/**
* Set the URL of this block's help page.
* @param {string|Function} url URL string for block help, or function that
...
...
core/connection.js
View file @
aa5afd18
...
...
@@ -40,9 +40,10 @@ Blockly.Connection = function(source, type) {
this
.
type
=
type
;
this
.
x_
=
0
;
this
.
y_
=
0
;
this
.
inDB_
=
false
;
// Shortcut for the databases for this connection's workspace.
this
.
dbList_
=
this
.
sourceBlock_
.
workspace
.
connectionDBList
;
this
.
dbList_
=
source
.
workspace
.
connectionDBList
;
this
.
hidden_
=
!
this
.
dbList_
;
this
.
inDB_
=
false
;
};
/**
...
...
@@ -54,7 +55,6 @@ Blockly.Connection.prototype.dispose = function() {
}
if
(
this
.
inDB_
)
{
this
.
dbList_
[
this
.
type
].
removeConnection_
(
this
);
this
.
inDB_
=
false
;
}
if
(
Blockly
.
highlightedConnection_
==
this
)
{
Blockly
.
highlightedConnection_
=
null
;
...
...
@@ -322,7 +322,7 @@ Blockly.Connection.prototype.moveTo = function(x, y) {
this
.
x_
=
x
;
this
.
y_
=
y
;
// Insert it into its new location in the database.
if
(
this
.
dbList
_
)
{
if
(
!
this
.
hidden
_
)
{
this
.
dbList_
[
this
.
type
].
addConnection_
(
this
);
}
};
...
...
@@ -336,6 +336,19 @@ Blockly.Connection.prototype.moveBy = function(dx, dy) {
this
.
moveTo
(
this
.
x_
+
dx
,
this
.
y_
+
dy
);
};
/**
* Set whether this connections is hidden (not tracked in a database) or not.
* @param {boolean} hidden True if connection is hidden.
*/
Blockly
.
Connection
.
prototype
.
setHidden
=
function
(
hidden
)
{
this
.
hidden_
=
hidden
;
if
(
hidden
&&
this
.
inDB_
)
{
this
.
dbList_
[
this
.
type
].
removeConnection_
(
this
);
}
else
if
(
!
hidden
&&
!
this
.
inDB_
)
{
this
.
dbList_
[
this
.
type
].
addConnection_
(
this
);
}
};
/**
* Add highlighting around this connection.
*/
...
...
@@ -653,7 +666,7 @@ Blockly.Connection.prototype.hideAll = function() {
* @return {!Array.<!Blockly.Block>} List of blocks to render.
*/
Blockly
.
Connection
.
prototype
.
unhideAll
=
function
()
{
if
(
!
this
.
inDB
_
)
{
if
(
!
this
.
hidden
_
)
{
this
.
dbList_
[
this
.
type
].
addConnection_
(
this
);
}
// All blocks that need unhiding must be unhidden before any rendering takes
...
...
core/xml.js
View file @
aa5afd18
...
...
@@ -248,11 +248,15 @@ Blockly.Xml.domToBlock = function(workspace, xmlBlock, opt_reuseBlock) {
var
blocks
=
topBlock
.
getDescendants
();
// Render each block.
for
(
var
i
=
blocks
.
length
-
1
;
i
>=
0
;
i
--
)
{
blocks
[
i
].
setConnectionsHidden
(
true
);
blocks
[
i
].
initSvg
();
}
for
(
var
i
=
blocks
.
length
-
1
;
i
>=
0
;
i
--
)
{
blocks
[
i
].
render
(
false
);
}
for
(
var
i
=
blocks
.
length
-
1
;
i
>=
0
;
i
--
)
{
blocks
[
i
].
setConnectionsHidden
(
false
);
}
topBlock
.
updateDisabled
();
// Fire an event to allow scrollbars to resize.
Blockly
.
fireUiEvent
(
window
,
'
resize
'
);
...
...
tests/playground.html
View file @
aa5afd18
...
...
@@ -439,7 +439,7 @@ h1 {
<p>
Stress test:
<input
type=
"button"
value=
"Airstrike!"
onclick=
"airstrike(100)"
>
<input
type=
"button"
value=
"Spaghetti!"
onclick=
"spaghetti(
6
)"
>
<input
type=
"button"
value=
"Spaghetti!"
onclick=
"spaghetti(
8
)"
>
</p>
<!-- Realtime setup buttons. -->
...
...
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