mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 10:28:12 +08:00
Implement Bezier curve reduce function (#711)
* fixed extrema bug and added reduce impl Co-authored-by: Rob Nadal <RobNadal@users.noreply.github.com> Co-authored-by: Linda Zheng <ll2zheng@uwaterloo.ca> Co-authored-by: Hannah Li <hannahli2010@gmail.com> * Stylistic changes related to reduce * Fixed reduce splitting bug causing panic * Added shortcuts and simplified reduce * Stylistic changes per review * address comments * Removed color gradient function and added consts * Tweaks * Change colors faster * Don't drop on mouseout Co-authored-by: Thomas Cheng <contact.chengthomas@gmail.com> Co-authored-by: Rob Nadal <RobNadal@users.noreply.github.com> Co-authored-by: Linda Zheng <ll2zheng@uwaterloo.ca> Co-authored-by: Hannah Li <hannahli2010@gmail.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Rob Nadal
Linda Zheng
Hannah Li
Thomas Cheng
Keavon Chambers
parent
f3d5028107
commit
b4ada6affd
@@ -266,6 +266,16 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Reduce",
|
||||
callback: (canvas: HTMLCanvasElement, bezier: WasmBezierInstance): void => {
|
||||
const context = getContextFromCanvas(canvas);
|
||||
const curves: Point[][] = JSON.parse(bezier.reduce());
|
||||
curves.forEach((points, index) => {
|
||||
drawBezier(context, points, null, { curveStrokeColor: `hsl(${40 * index}, 100%, 50%)`, radius: 3.5, drawHandles: false });
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user