Skip to content

Commit 097dd4d

Browse files
committed
Make blockly width adjustable.
1 parent 5aec6e1 commit 097dd4d

File tree

5 files changed

+752
-0
lines changed

5 files changed

+752
-0
lines changed

editor.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ <h2><i class="fa fa-unlock-alt"></i> <strong>{{ title }}</strong></h2>
259259
<script src="microbit_blocks/generators/python.js"></script>
260260
<script src="blockly/msg/js/en.js"></script>
261261
<script src="microbit_blocks/messages/en/messages.js"></script>
262+
<script src="static/js/ResizeSensor.js"></script>
263+
<script src="static/js/ElementQueries.js"></script>
262264
<script src="python-main.js"
263265
type="application/javascript"></script>
264266
<script>vex.defaultOptions.className = 'vex-theme-wireframe';</script>

python-main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,11 @@ function web_editor(config) {
532532
var code = Blockly.Python.workspaceToCode(workspace);
533533
EDITOR.setCode(code);
534534
}
535+
// Resize blockly
536+
var element = document.getElementById('blockly');
537+
new ResizeSensor(element, function() {
538+
Blockly.svgResize(workspace);
539+
});
535540
workspace.addChangeListener(myUpdateFunction);
536541
}
537542
// Set editor to current state of blocks.

static/css/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#blockly {
1212
display: none;
1313
min-width: 570px;
14+
overflow: auto;
15+
resize: horizontal;
1416
}
1517

1618
/* Re-usable, generic rules */

0 commit comments

Comments
 (0)