Update spline_editor.js

This commit is contained in:
kijai 2024-05-06 21:39:22 +03:00
parent 3b999778f0
commit 07ba67864a

View File

@ -207,6 +207,8 @@ app.registerExtension({
function createSplineEditor(context, reset=false) {
console.log("creatingSplineEditor")
// context menu
function createContextMenu() {
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});
@ -260,9 +262,9 @@ function createSplineEditor(context, reset=false) {
}
console.log(dotShape)
updatePath();
});
});
context.menuItem4.addEventListener('click', function(e) {
context.menuItem4.addEventListener('click', function(e) {
// Create file input element
const fileInput = document.createElement('input');
fileInput.type = 'file';
@ -293,11 +295,13 @@ context.menuItem4.addEventListener('click', function(e) {
fileInput.click();
}
context.contextMenu.style.display = 'none';
});
});
}
var dotShape = "circle";
var drawSamplePoints = false;
createContextMenu();
function updatePath() {
let coords = samplePoints(pathElements[0], points_to_sample, samplingMethod, w);
@ -478,6 +482,7 @@ context.menuItem4.addEventListener('click', function(e) {
}
})
var backgroundImage = vis.add(pv.Image)
.visible(false)
vis.add(pv.Rule)
.data(pv.range(0, h, 64))
.bottom(d => d)