Update spline_editor.js

This commit is contained in:
kijai 2025-06-16 17:17:31 +03:00
parent b560966027
commit b5e654103a

View File

@ -493,7 +493,7 @@ this.lastMousePosition = { x: this.width/2, y: this.height/2 };
}) })
.left(d => d.x) .left(d => d.x)
.top(d => d.y) .top(d => d.y)
.radius(10) .radius(12)
.shape(function() { .shape(function() {
return self.dotShape; return self.dotShape;
}) })
@ -909,32 +909,32 @@ this.lastMousePosition = { x: this.width/2, y: this.height/2 };
} }
}); });
// Add invisible wider hit area for easier selection // // Add invisible wider hit area for easier selection
this.vis.add(pv.Line) // this.vis.add(pv.Line)
.data(() => spline.points) // .data(() => spline.points)
.left(d => d.x) // .left(d => d.x)
.top(d => d.y) // .top(d => d.y)
.interpolate(() => this.interpolation) // .interpolate(() => this.interpolation)
.tension(() => this.tension) // .tension(() => this.tension)
.segmented(() => false) // .segmented(() => false)
.strokeStyle("rgba(0,0,0,0.01)") // Nearly invisible // .strokeStyle("rgba(0,0,0,0.01)") // Nearly invisible
.lineWidth(15) // Much wider hit area // .lineWidth(15) // Much wider hit area
.event("mouseover", () => { // .event("mouseover", () => {
this.hoverSplineIndex = splineIndex; // this.hoverSplineIndex = splineIndex;
this.vis.render(); // this.vis.render();
}) // })
.event("mouseout", () => { // .event("mouseout", () => {
this.hoverSplineIndex = -1; // this.hoverSplineIndex = -1;
this.vis.render(); // this.vis.render();
}) // })
.event("mousedown", () => { // .event("mousedown", () => {
if (pv.event.shiftKey) { // if (pv.event.shiftKey) {
if (this.activeSplineIndex !== splineIndex) { // if (this.activeSplineIndex !== splineIndex) {
this.activeSplineIndex = splineIndex; // this.activeSplineIndex = splineIndex;
this.refreshSplineElements(); // this.refreshSplineElements();
} // }
}} // }}
); // );
this.lineObjects.push(lineObj); this.lineObjects.push(lineObj);
} }