mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-11 11:14:04 +02:00
rewrite to handler.js format
This commit is contained in:
37
components/sections/graduatedoffset/handler.js
Normal file
37
components/sections/graduatedoffset/handler.js
Normal file
@@ -0,0 +1,37 @@
|
||||
module.exports = {
|
||||
statics: {
|
||||
keyHandlingOptions: {
|
||||
propName: "distance",
|
||||
values: {
|
||||
"38": 1, // up arrow
|
||||
"40": -1 // down arrow
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setup: function(api, curve) {
|
||||
api.setCurve(curve);
|
||||
api.distance = 20;
|
||||
},
|
||||
|
||||
setupQuadratic: function(api) {
|
||||
var curve = api.getDefaultQuadratic();
|
||||
this.setup(api, curve);
|
||||
},
|
||||
|
||||
setupCubic: function(api) {
|
||||
var curve = api.getDefaultCubic();
|
||||
this.setup(api, curve);
|
||||
},
|
||||
|
||||
draw: function(api, curve) {
|
||||
api.reset();
|
||||
api.drawSkeleton(curve);
|
||||
api.drawCurve(curve);
|
||||
|
||||
|
||||
api.setColor("blue");
|
||||
var outline = curve.outline(0,0,api.distance,api.distance);
|
||||
outline.curves.forEach(c => api.drawCurve(c));
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user