Skip to content

Commit 4c4a91a

Browse files
committed
make live editor resizable
1 parent 9928282 commit 4c4a91a

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎v3/js/opt-live.js‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ function optliveHandleUncaughtExceptionFunc(trace) {
325325

326326
if (myVisualizer) {
327327
toggleSyntaxError(true);
328-
myVisualizer.updateOutput(); // to update arrows
328+
myVisualizer.redrawConnectors();
329329
}
330330

331331
var s = pyInputAceEditor.getSession();
@@ -354,12 +354,22 @@ function initAceEditor(height) {
354354

355355
pyInputAceEditor.$blockScrolling = Infinity; // kludgy to shut up weird warnings
356356

357-
// auto-grow height as fit
358-
pyInputAceEditor.setOptions({minLines: 20, maxLines: 20});
359-
360-
$("#pyInputPane,#codeInputPane").css('width', aceEditorWidth);
357+
$("#pyInputPane,#codeInputPane")
358+
.css('width', aceEditorWidth)
359+
.css('min-width', '250px');
361360
$('#codeInputPane').css('height', height + 'px'); // VERY IMPORTANT so that it works on I.E., ugh!
362361

362+
// make it resizable!
363+
$("#codeInputPane").resizable({
364+
resize: function(evt, ui) {
365+
pyInputAceEditor.resize(); // to keep Ace internals happy
366+
$("#pyInputPane").width($("#codeInputPane").width()); // to keep parent happy
367+
if (myVisualizer) {
368+
myVisualizer.redrawConnectors(); // to keep visualizations happy
369+
}
370+
}
371+
});
372+
363373
pyInputAceEditor.on('change', function(e) {
364374
$.doTimeout('pyInputAceEditorChange',
365375
500, /* go a bit faster than CODE_SNAPSHOT_DEBOUNCE_MS to feel more snappy */

‎v3/live.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484
<option value="3">Python 3.3</option>
8585
<option value="js">JavaScript ES6</option>
8686
</select>
87+
88+
<span style="color: #888; font-size: 8pt; float: right;">(drag lower right corner to resize code editor)</span>
8789
</div>
8890

8991
<div id="codeInputPane"></div>

0 commit comments

Comments
 (0)