tooltip: Add alignment options.

It's a list of preferred alignments because sometime the best one wont
fit in the screen.
This commit is contained in:
Emmanuel Lepage Vallee 2018-12-21 21:29:56 -05:00
parent 7d6f52c4dc
commit 3380fd85fc
1 changed files with 13 additions and 0 deletions

View File

@ -124,6 +124,7 @@ local function apply_outside_mode(self)
local _, position = a_placement.next_to(w, {
geometry = self._private.widget_geometry,
preferred_positions = self.preferred_positions,
preferred_anchors = self.preferred_alignments,
honor_workarea = true,
})
@ -326,6 +327,18 @@ function tooltip:set_preferred_positions(value)
set_geometry(self)
end
function tooltip:get_preferred_alignments()
return self._private.preferred_alignments or
{"front", "back", "middle"}
end
function tooltip:set_preferred_alignments(value)
self._private.preferred_alignments = value
set_geometry(self)
end
--- Change displayed text.
--
-- @property text