Commit 45a940cc authored by Diego Gangl's avatar Diego Gangl Committed by Alexandru Băluț

viewer: Use line design for overlay

parent e67e712b
......@@ -555,24 +555,28 @@ class MoveScaleOverlay(Overlay):
return
cr.save()
# clear background
# Clear background
cr.set_operator(cairo.OPERATOR_OVER)
cr.set_source_rgba(0.0, 0.0, 0.0, 0.0)
cr.set_source_rgba(0, 0, 0, 0)
cr.paint()
if hovered:
brightness = 0.65
else:
brightness = 0.3
if not selected:
cr.set_dash((5, 5))
# clip away outer mask
self.__draw_rectangle(cr)
cr.clip()
cr.set_source_rgba(brightness, brightness, brightness, 0.6)
# Black outline around the box
cr.set_source_rgb(0, 0, 0)
cr.set_line_width(3)
self.__draw_rectangle(cr)
cr.stroke()
cr.set_line_width(16)
# Inner white line
color = (0.8, 0.8, 0.8) if not selected else (1, 1, 1)
cr.set_source_rgb(*color)
cr.set_line_width(1)
self.__draw_rectangle(cr)
cr.stroke()
cr.restore()
if selected:
......
......@@ -130,26 +130,32 @@ class TitleOverlay(Overlay):
self._commit()
def do_draw(self, cr):
if not self._is_selected() and not self._is_hovered():
selected = self._is_selected()
hovered = self._is_hovered()
if not selected and not hovered:
return
cr.save()
# clear background
# Clear background
cr.set_operator(cairo.OPERATOR_OVER)
cr.set_source_rgba(0.0, 0.0, 0.0, 0.0)
cr.set_source_rgba(0, 0, 0, 0)
cr.paint()
if self._is_hovered():
brightness = 0.65
else:
brightness = 0.3
if not selected:
cr.set_dash((5, 5))
# clip away outer mask
self.__draw_rectangle(cr)
cr.clip()
cr.set_source_rgba(brightness, brightness, brightness, 0.6)
# Black outline around the box
cr.set_source_rgb(0, 0, 0)
cr.set_line_width(3)
self.__draw_rectangle(cr)
cr.stroke()
cr.set_line_width(16)
# Inner white line
color = (0.8, 0.8, 0.8) if not selected else (1, 1, 1)
cr.set_source_rgb(*color)
cr.set_line_width(1)
self.__draw_rectangle(cr)
cr.stroke()
cr.restore()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment