renamed val_gap to option_gap, updated docs/changelog

develop
Taxi Service 2023-05-02 16:46:46 +02:00
parent f181b50a30
commit ef0c8950bd
3 changed files with 5 additions and 5 deletions

@ -70,7 +70,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Lua
- ``widgets.RangeSlider``: new mouse-controlled two-headed slider widget
- ``gui.ZScreenModal``: ZScreen subclass for modal dialogs
- ``widgets.CycleHotkeyLabel``: exposed "key_sep" and "val_gap" attributes for improved stylistic control.
- ``widgets.CycleHotkeyLabel``: exposed "key_sep" and "option_gap" attributes for improved stylistic control.
## Removed
- `title-version`: replaced by an `overlay` widget

@ -4920,7 +4920,7 @@ It has the following attributes:
aligning a column of ``CycleHotkeyLabel`` labels).
:label_below: If ``true``, then the option value will appear below the label
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.
:option_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.
If ``label_below`` == ``true``, negative values will shift the value leftwards.
:options: A list of strings or tables of

@ -1491,7 +1491,7 @@ CycleHotkeyLabel.ATTRS{
key=DEFAULT_NIL,
key_back=DEFAULT_NIL,
key_sep=': ',
val_gap=1,
option_gap=1,
label=DEFAULT_NIL,
label_width=DEFAULT_NIL,
label_below=false,
@ -1504,7 +1504,7 @@ function CycleHotkeyLabel:init()
self:setOption(self.initial_option)
if self.label_below then
self.val_gap = self.val_gap + (self.key_back and 1 or 0) + (self.key and 2 or 0)
self.option_gap = self.option_gap + (self.key_back and 1 or 0) + (self.key and 2 or 0)
end
self:setText{
@ -1512,7 +1512,7 @@ function CycleHotkeyLabel:init()
{key=self.key, key_sep=self.key_sep, text=self.label, width=self.label_width,
on_activate=self:callback('cycle')},
self.label_below and NEWLINE or '',
{gap=self.val_gap, text=self:callback('getOptionLabel'),
{gap=self.option_gap, text=self:callback('getOptionLabel'),
pen=self:callback('getOptionPen')},
}
end