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
92d482b1
Commit
92d482b1
authored
May 31, 2015
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes carlosperate/ardublockly#3 and carlosperate/ardublockly#9
parent
6a30d3aa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
26 deletions
+38
-26
ardublockly/ardublockly.js
ardublockly/ardublockly.js
+3
-1
ardublockly/ardublockly_blockly.js
ardublockly/ardublockly_blockly.js
+12
-11
ardublockly/ardublockly_design.js
ardublockly/ardublockly_design.js
+23
-14
No files found.
ardublockly/ardublockly.js
View file @
92d482b1
...
...
@@ -26,6 +26,8 @@ window.addEventListener('load', function load(event) {
ArduinoMaterial
.
bindDesignEventListeners_
();
ArduinoMaterial
.
bindBlocklyEventListeners_
();
ArduinoMaterial
.
resizeToggleToolboxBotton
();
// Check if not running locally (including developer's local network IP)
if
(
document
.
location
.
hostname
!=
'
localhost
'
&&
document
.
location
.
hostname
!=
'
192.168.0.7
'
)
{
...
...
ardublockly/ardublockly_blockly.js
View file @
92d482b1
...
...
@@ -54,7 +54,7 @@ ArduinoMaterial.injectBlockly = function(blocklyEl, toolboxPath) {
trashcan
:
true
});
ArduinoMaterial
.
BLOCKLY_INJECTED
=
true
;
}
}
}
;
// If file run locally Chrome will fail here
try
{
...
...
@@ -159,15 +159,16 @@ ArduinoMaterial.loadBlocksfromXmlDom = function(blocksXmlDom) {
*/
ArduinoMaterial
.
showToolbox
=
function
(
show
,
callback
)
{
var
resizeWorkspaceAndCallback
=
function
()
{
/* For some reason the workspace only resizes after second call */
//Blockly.fireUiEvent(window, 'resize');
//Blockly.fireUiEvent(window, 'resize');
//callback.call();
ArduinoMaterial
.
workspace
.
render
();
if
(
callback
&&
((
typeof
callback
)
===
(
typeof
Function
)))
{
callback
();
}
};
if
(
show
==
false
)
{
$
(
'
.blocklyToolboxDiv
'
).
slideUp
(
300
,
c
allback
);
$
(
'
.blocklyToolboxDiv
'
).
slideUp
(
300
,
resizeWorkspaceAndC
allback
);
}
else
{
$
(
'
.blocklyToolboxDiv
'
).
slideDown
(
300
,
c
allback
);
$
(
'
.blocklyToolboxDiv
'
).
slideDown
(
300
,
resizeWorkspaceAndC
allback
);
}
};
...
...
@@ -177,7 +178,7 @@ ArduinoMaterial.showToolbox = function(show, callback) {
ArduinoMaterial
.
discard
=
function
()
{
var
blockCount
=
ArduinoMaterial
.
workspace
.
getAllBlocks
().
length
;
if
(
blockCount
==
1
)
{
Blockly
.
mainW
orkspace
.
clear
();
ArduinoMaterial
.
w
orkspace
.
clear
();
ArduinoMaterial
.
renderContent
();
}
else
if
(
blockCount
>
1
)
{
ArduinoMaterial
.
materialAlert
(
...
...
@@ -186,7 +187,7 @@ ArduinoMaterial.discard = function() {
sure you want to delete them?
'
,
true
,
function
()
{
Blockly
.
mainW
orkspace
.
clear
();
ArduinoMaterial
.
w
orkspace
.
clear
();
ArduinoMaterial
.
renderContent
();
});
}
...
...
ardublockly/ardublockly_design.js
View file @
92d482b1
...
...
@@ -109,18 +109,27 @@ ArduinoMaterial.resizeBlocklyWorkspace = function() {
contentBlocks
.
style
.
width
=
wrapperPanelSize
.
width
+
'
px
'
;
contentBlocks
.
style
.
width
=
(
2
*
wrapperPanelSize
.
width
-
contentBlocks
.
offsetWidth
)
+
'
px
'
;
};
//Blockly.MsvgResize();
//Blockly.mainWorkspace.render();
//alert(
// 'resized ' + wrapperPanelSize.width + ' ' + contentBlocks.style.width);
/**
* Resizes the toolbox button to toggle its visibility to the width of the
* toolbox.
* The toolbox width does not change with workspace width, so safe to do once,
* but it needs to be done after blockly has been injected.
* @private
*/
ArduinoMaterial
.
resizeToggleToolboxBotton
=
function
()
{
// As the toolbox inject is asynchronous we need to wait
if
(
ArduinoMaterial
.
BLOCKLY_INJECTED
==
false
)
{
setTimeout
(
ArduinoMaterial
.
resizeToggleToolboxBotton
,
50
);
}
else
{
// Sets the toolbox toggle button width to that of the toolbox
if
(
ArduinoMaterial
.
isToolboxVisible
()
&&
ArduinoMaterial
.
workspace
.
toolbox_
.
width
)
{
// For some reason normal set style and getElementById didn't work
$
(
'
#button_toggle_toolbox
'
).
width
(
ArduinoMaterial
.
workspace
.
toolbox_
.
width
);
}
}
};
/**
...
...
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