File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 136136< script >
137137const API = 'https://bench-volumes-pontiac-riders.trycloudflare.com' ;
138138
139+ const DEFAULT = `float angle = 0;
140+
141+ void setup() {
142+ size(500, 400, P3D);
143+ }
144+
145+ void draw() {
146+ background(20);
147+ lights();
148+ translate(width/2, height/2);
149+ rotateX(angle * 0.7f);
150+ rotateY(angle);
151+ fill(232, 180, 0);
152+ box(130);
153+ angle += 0.02f;
154+ }` ;
155+
139156const editor = CodeMirror . fromTextArea ( document . getElementById ( 'code' ) , {
140157 mode : 'cppmode' ,
141158 theme : 'cppmode' ,
256273 document . head . appendChild ( script ) ;
257274}
258275
276+ const _origPreventDefault = Event . prototype . preventDefault ;
277+ Event . prototype . preventDefault = function ( ) {
278+ if ( this . type === 'keydown' || this . type === 'keyup' || this . type === 'keypress' ) {
279+ const ta = document . querySelector ( '.CodeMirror textarea' ) ;
280+ if ( ta && document . activeElement === ta ) return ;
281+ }
282+ return _origPreventDefault . call ( this ) ;
283+ } ;
284+
259285document . addEventListener ( 'keydown' , e => {
260286 if ( ( e . ctrlKey || e . metaKey ) && e . key === 'Enter' ) { e . preventDefault ( ) ; runSketch ( ) ; }
261287} ) ;
You can’t perform that action at this time.
0 commit comments