Skip to content

Commit

Permalink
add "circle" and "checkmark" options to the "points" tool (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
maoschanz committed Mar 7, 2024
1 parent 9bff79c commit be80230
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ drawing (1.2.0) unstable; urgency=low
* better update the preview of most tools when their options change (#357)
* update the user help manual
* preserve transparency of the original area when skewing with a solid background color
* add "circle" and "checkmark" options to the "points" tool (#458)
* update several translations

-- Romain F. T. <[email protected]> Sat, 16 Mar 2024 13:12:00 +0100
Expand Down
10 changes: 10 additions & 0 deletions src/tools/classic_tools/tool_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def on_options_changed(self):
self._shape_label = _("X-shaped cross")
elif state_as_string == 'square':
self._shape_label = _("Square")
elif state_as_string == 'dot':
self._shape_label = _("Dot")
elif state_as_string == 'checkmark':
self._shape_label = _("Checkmark")
else:
self._shape_label = _("Circle")
self._points_type = state_as_string
Expand Down Expand Up @@ -133,7 +137,13 @@ def do_tool_operation(self, operation):
point_type = operation['point_type']
if point_type == 'circle':
cairo_context.arc(x, y, half_width, 0.0, 2 * math.pi)
elif point_type == 'dot':
cairo_context.arc(x, y, half_width, 0.0, 2 * math.pi)
cairo_context.fill()
elif point_type == 'checkmark':
cairo_context.move_to(x - half_width, y)
cairo_context.line_to(x - 0.2 * half_width, y + 0.8 * half_width)
cairo_context.line_to(x + half_width, y - half_width)
elif point_type == 'cross':
# Looks awful with small sizes, either with or without antialiasing
cairo_context.move_to(x, y - half_width)
Expand Down
10 changes: 10 additions & 0 deletions src/tools/ui/tool-points.ui
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
<attribute name="action">win.points_type</attribute>
<attribute name="target">circle</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Dot</attribute>
<attribute name="action">win.points_type</attribute>
<attribute name="target">dot</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Cross</attribute>
<attribute name="action">win.points_type</attribute>
Expand All @@ -23,6 +28,11 @@
<attribute name="action">win.points_type</attribute>
<attribute name="target">square</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Checkmark</attribute>
<attribute name="action">win.points_type</attribute>
<attribute name="target">checkmark</attribute>
</item>
</section>
<section>
<item>
Expand Down

0 comments on commit be80230

Please sign in to comment.