mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 04:18:12 +08:00
Implement bounding box function for bezier-rs (#726)
* Implement bounding box function for bezier-rs * Fix eslint errors Co-authored-by: Linda Zheng <linda-zheng@users.noreply.github.com> * Rename bbox to bounding_box * Address Keavon's comments * Fix eslint issue Co-authored-by: Hannah Li <hannahli2010@gmail.com> Co-authored-by: Linda Zheng <linda-zheng@users.noreply.github.com>
This commit is contained in:
co-authored by
Linda Zheng
Hannah Li
parent
aeb9e85726
commit
a5bb153dab
@@ -356,6 +356,19 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Bounding Box",
|
||||
callback: (canvas: HTMLCanvasElement, bezier: WasmBezierInstance): void => {
|
||||
const context = getContextFromCanvas(canvas);
|
||||
const bboxPoints: Point[] = JSON.parse(bezier.bounding_box());
|
||||
const minPoint = bboxPoints[0];
|
||||
const maxPoint = bboxPoints[1];
|
||||
drawLine(context, minPoint, { x: minPoint.x, y: maxPoint.y }, COLORS.NON_INTERACTIVE.STROKE_1);
|
||||
drawLine(context, minPoint, { x: maxPoint.x, y: minPoint.y }, COLORS.NON_INTERACTIVE.STROKE_1);
|
||||
drawLine(context, maxPoint, { x: minPoint.x, y: maxPoint.y }, COLORS.NON_INTERACTIVE.STROKE_1);
|
||||
drawLine(context, maxPoint, { x: maxPoint.x, y: minPoint.y }, COLORS.NON_INTERACTIVE.STROKE_1);
|
||||
},
|
||||
},
|
||||
],
|
||||
subpathFeatures: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user