You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Add width and antialiased parameters to CanvasItem draw_rect()
This also removes some duplicated editor code which is now obsoleted by the new parameters in `draw_rect()`.
This commit is contained in:
@@ -715,7 +715,7 @@ void CurveEditor::_draw() {
|
||||
if (_hover_point != -1) {
|
||||
const Color hover_color = line_color;
|
||||
Vector2 pos = curve.get_point_position(_hover_point);
|
||||
stroke_rect(Rect2(get_view_pos(pos), Vector2(1, 1)).grow(_hover_radius), hover_color);
|
||||
draw_rect(Rect2(get_view_pos(pos), Vector2(1, 1)).grow(_hover_radius), hover_color, false, Math::round(EDSCALE));
|
||||
}
|
||||
|
||||
// Help text
|
||||
@@ -726,23 +726,6 @@ void CurveEditor::_draw() {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO That should be part of the drawing API...
|
||||
void CurveEditor::stroke_rect(Rect2 rect, Color color) {
|
||||
|
||||
// a---b
|
||||
// | |
|
||||
// c---d
|
||||
Vector2 a(rect.position);
|
||||
Vector2 b(rect.position.x + rect.size.x, rect.position.y);
|
||||
Vector2 c(rect.position.x, rect.position.y + rect.size.y);
|
||||
Vector2 d(rect.position + rect.size);
|
||||
|
||||
draw_line(a, b, color, Math::round(EDSCALE));
|
||||
draw_line(b, d, color, Math::round(EDSCALE));
|
||||
draw_line(d, c, color, Math::round(EDSCALE));
|
||||
draw_line(c, a, color, Math::round(EDSCALE));
|
||||
}
|
||||
|
||||
void CurveEditor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_gui_input"), &CurveEditor::on_gui_input);
|
||||
ClassDB::bind_method(D_METHOD("_on_preset_item_selected"), &CurveEditor::on_preset_item_selected);
|
||||
|
||||
Reference in New Issue
Block a user