broadfield-dev commited on
Commit
ed8945f
·
verified ·
1 Parent(s): cbf0897

Update static/canvas.js

Browse files
Files changed (1) hide show
  1. static/canvas.js +6 -7
static/canvas.js CHANGED
@@ -352,9 +352,8 @@ function createNode(x, y, label, type, inputs = [], outputs = [], id, source = '
352
  padding: 5
353
  });
354
 
355
- //codeWindow.add(codeBox);
356
- // codeWindow.add(codeText);
357
- // layer.add(codeWindow);
358
 
359
  // Create textarea for editing
360
  codeTextarea = document.createElement('textarea');
@@ -362,8 +361,8 @@ function createNode(x, y, label, type, inputs = [], outputs = [], id, source = '
362
  const canvasRect = stage.container().getBoundingClientRect();
363
  const textareaX = (nodePos.x + stage.x()) / scale + canvasRect.left;
364
  const textareaY = (nodePos.y + height + 10 + stage.y()) / scale + canvasRect.top;
365
- //codeTextarea.style.left = `${textareaX}px`;
366
- //codeTextarea.style.top = `${textareaY}px`;
367
  codeTextarea.style.width = `${300 / scale}px`;
368
  codeTextarea.style.height = `${100 / scale}px`;
369
  codeTextarea.style.fontFamily = 'monospace';
@@ -372,11 +371,11 @@ function createNode(x, y, label, type, inputs = [], outputs = [], id, source = '
372
  codeTextarea.style.border = 'none';
373
  codeTextarea.style.resize = 'none';
374
  codeTextarea.value = source || '';
375
- //document.body.appendChild(codeTextarea);
376
 
377
  codeWindow.add(codeBox);
378
  codeWindow.add(codeText);
379
- codeWindow.add(codeTextarea);
380
  layer.add(codeWindow);
381
  // Update code on change
382
  codeTextarea.addEventListener('change', () => {
 
352
  padding: 5
353
  });
354
 
355
+ codeWindow.add(codeBox);
356
+ codeWindow.add(codeText);
 
357
 
358
  // Create textarea for editing
359
  codeTextarea = document.createElement('textarea');
 
361
  const canvasRect = stage.container().getBoundingClientRect();
362
  const textareaX = (nodePos.x + stage.x()) / scale + canvasRect.left;
363
  const textareaY = (nodePos.y + height + 10 + stage.y()) / scale + canvasRect.top;
364
+ codeTextarea.style.right = '-20px' || `${textareaX}px`;
365
+ codeTextarea.style.top = '20px' || `${textareaY}px`;
366
  codeTextarea.style.width = `${300 / scale}px`;
367
  codeTextarea.style.height = `${100 / scale}px`;
368
  codeTextarea.style.fontFamily = 'monospace';
 
371
  codeTextarea.style.border = 'none';
372
  codeTextarea.style.resize = 'none';
373
  codeTextarea.value = source || '';
374
+ document.body.appendChild(codeTextarea);
375
 
376
  codeWindow.add(codeBox);
377
  codeWindow.add(codeText);
378
+ //codeWindow.add(codeTextarea);
379
  layer.add(codeWindow);
380
  // Update code on change
381
  codeTextarea.addEventListener('change', () => {