make val_sep useful if label_below == true

develop
Taxi Service 2023-04-30 10:18:15 +02:00
parent 923f84b2f2
commit cfcb1cd937
2 changed files with 3 additions and 3 deletions

@ -4918,11 +4918,11 @@ It has the following attributes:
hotkey. hotkey.
:label_width: The number of spaces to allocate to the ``label`` (for use in :label_width: The number of spaces to allocate to the ``label`` (for use in
aligning a column of ``CycleHotkeyLabel`` labels). aligning a column of ``CycleHotkeyLabel`` labels).
:label_below: If ``true``, then the option value will apear below the label :label_below: If ``true``, then the option value will appear below the label
instead of to the right of it. Defaults to ``false``. instead of to the right of it. Defaults to ``false``.
:val_gap: The size of the gap between the label text and the option value. :val_gap: The size of the gap between the label text and the option value.
Default is ``1``. If set to ``0``, there'll be no gap between the strings. Default is ``1``. If set to ``0``, there'll be no gap between the strings.
Note that ``val_gap`` is ignored if ``label_below`` is set to ``true``. If ``label_below`` == ``true``, negative values will shift the value leftwards.
:options: A list of strings or tables of :options: A list of strings or tables of
``{label=string or fn, value=val[, pen=pen]}``. String options use the same ``{label=string or fn, value=val[, pen=pen]}``. String options use the same
string for the label and value and use the default pen. The optional ``pen`` string for the label and value and use the default pen. The optional ``pen``

@ -1502,7 +1502,7 @@ function CycleHotkeyLabel:init()
self:setOption(self.initial_option) self:setOption(self.initial_option)
if self.label_below then if self.label_below then
self.val_gap = 0 + (self.key_back and 1 or 0) + (self.key and 3 or 0) self.val_gap = self.val_gap + (self.key_back and 1 or 0) + (self.key and 2 or 0)
end end
self:setText{ self:setText{