Skip to content

Commit

Permalink
viliusle#311 polygons
Browse files Browse the repository at this point in the history
  • Loading branch information
viliusle committed Jan 7, 2023
1 parent fc0ccf3 commit bbb17d5
Show file tree
Hide file tree
Showing 4 changed files with 430 additions and 19 deletions.
62 changes: 46 additions & 16 deletions images/test-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -1741,22 +1741,10 @@
"composition": "source-over",
"rotate": null,
"data": {
"start": {
"x": 400,
"y": 660.5
},
"cp1": {
"x": 477.5,
"y": 661.5
},
"cp2": {
"x": 400,
"y": 708
},
"end": {
"x": 480,
"y": 707.5
}
"start": {"x": 400, "y": 660.5},
"cp1": {"x": 477.5, "y": 661.5},
"cp2": {"x": 400, "y": 708},
"end": {"x": 480, "y": 707.5}
},
"params": {
"size": 4
Expand All @@ -1768,6 +1756,48 @@
"bezier_curve",
"render"
]
},
{
"id": 49,
"parent_id": 0,
"name": "Polygon #49",
"type": "polygon",
"link": null,
"x": 0,
"y": 0,
"width": null,
"width_original": null,
"height": null,
"height_original": null,
"visible": true,
"is_vector": true,
"hide_selection_if_active": true,
"opacity": 100,
"order": 49,
"composition": "source-over",
"rotate": null,
"data": [
{"x": 950, "y": 551},
{"x": 950, "y": 599},
{"x": 900, "y": 599},
{"x": 935, "y": 586},
{"x": 915, "y": 533.2}
],
"params": {
"size": 4,
"border_size": 4,
"border": true,
"fill": true,
"border_color": "#555555",
"fill_color": "#aaaaaa"
},
"status": "draft",
"color": "#ff0000",
"filters": [],
"render_function": [
"polygon",
"render"
]
}
],
"data": [
Expand Down
12 changes: 12 additions & 0 deletions src/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,18 @@ config.TOOLS = [
delay: 400,
},
},
{
name: 'polygon',
visible: false,
attributes: {
size: 4,
border_size: 4,
border: true,
fill: true,
border_color: '#555555',
fill_color: '#aaaaaa',
},
},
];

//link to active tool
Expand Down
6 changes: 3 additions & 3 deletions src/js/tools/shapes/bezier_curve.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,15 @@ class Bezier_Curve_class extends Base_tools_class {
end: {x: x + width, y: y + height}
};

this.draw_bezier(ctx, 0, 0, data, 2, '#555', true, null);
this.draw_bezier(ctx, 0, 0, data, 2, '#555');
}

render(ctx, layer) {
var params = layer.params;
this.draw_bezier(ctx, layer.x, layer.y, layer.data, params.size, layer.color, false, layer.id);
this.draw_bezier(ctx, layer.x, layer.y, layer.data, params.size, layer.color);
}

draw_bezier(ctx, x, y, data, lineWidth, color, is_demo, layer_id) {
draw_bezier(ctx, x, y, data, lineWidth, color) {
if(data.end.x == null || data.cp2.x == null){
return;
}
Expand Down
Loading

0 comments on commit bbb17d5

Please sign in to comment.