Spaces:
Running
Running
Update static/canvas.js
Browse files- static/canvas.js +25 -19
static/canvas.js
CHANGED
@@ -326,6 +326,28 @@ function createNode(x, y, label, type, inputs = [], outputs = [], id, source = '
|
|
326 |
}
|
327 |
|
328 |
const nodePos = node.getAbsolutePosition();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
codeWindow = new Konva.Group({
|
330 |
x: node.x(),
|
331 |
y: node.y() + height + 10
|
@@ -352,26 +374,10 @@ function createNode(x, y, label, type, inputs = [], outputs = [], id, source = '
|
|
352 |
padding: 5
|
353 |
});
|
354 |
|
355 |
-
codeWindow.add(codeBox);
|
356 |
-
codeWindow.add(codeText);
|
|
|
357 |
|
358 |
-
// Create textarea for editing
|
359 |
-
codeTextarea = document.createElement('textarea');
|
360 |
-
codeTextarea.style.position = 'relative';
|
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';
|
369 |
-
codeTextarea.style.fontSize = `${12 / scale}px`;
|
370 |
-
codeTextarea.style.background = 'transparent';
|
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);
|
|
|
326 |
}
|
327 |
|
328 |
const nodePos = node.getAbsolutePosition();
|
329 |
+
|
330 |
+
// Create textarea for editing
|
331 |
+
codeTextarea = document.createElement('textarea');
|
332 |
+
codeTextarea.style.position = 'relative';
|
333 |
+
const canvasRect = stage.container().getBoundingClientRect();
|
334 |
+
const textareaX = nodePos.x;
|
335 |
+
// const textareaX = (nodePos.x + stage.x()) / scale + canvasRect.left;
|
336 |
+
// const textareaY = (nodePos.y + height + 10 + stage.y()) / scale + canvasRect.top;
|
337 |
+
const textareaY = nodePos.y;
|
338 |
+
codeTextarea.style.right = `${textareaX}px`;
|
339 |
+
codeTextarea.style.top = `${textareaY}px`;
|
340 |
+
//codeTextarea.style.right = '-20px' || `${textareaX}px`;
|
341 |
+
//codeTextarea.style.top = '20px' || `${textareaY}px`;
|
342 |
+
codeTextarea.style.width = `${300 / scale}px`;
|
343 |
+
codeTextarea.style.height = `${100 / scale}px`;
|
344 |
+
codeTextarea.style.fontFamily = 'monospace';
|
345 |
+
codeTextarea.style.fontSize = `${12 / scale}px`;
|
346 |
+
codeTextarea.style.background = 'transparent';
|
347 |
+
codeTextarea.style.border = 'none';
|
348 |
+
codeTextarea.style.resize = 'none';
|
349 |
+
codeTextarea.value = source || '';
|
350 |
+
document.body.appendChild(codeTextarea);
|
351 |
codeWindow = new Konva.Group({
|
352 |
x: node.x(),
|
353 |
y: node.y() + height + 10
|
|
|
374 |
padding: 5
|
375 |
});
|
376 |
|
377 |
+
//codeWindow.add(codeBox);
|
378 |
+
//codeWindow.add(codeText);
|
379 |
+
|
380 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
|
382 |
codeWindow.add(codeBox);
|
383 |
codeWindow.add(codeText);
|