mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-29 01:34:29 +01:00
Scripts: a queued list choice is dropped when a handler replaced the item, and the new items stay kept while counted
A list counts how many times a script replaced its items, so a choice queued against an item a handler removed and added again with the same text is not replayed against the new item. The items array stays kept from collection while the count's slot reserves room.
This commit is contained in:
1 parent
4281309e27
commit
f6aef4fc8a
6 files changed
+59
-9
No files matched your search
@@ -139,6 +139,9 @@ pub struct UiNode {
|
||||
pub min: f64,
|
||||
pub max: f64,
|
||||
pub items: Vec<String>,
|
||||
/// How many times the script replaced a list's items (removed or added some), which tells a
|
||||
/// list from one that holds the same texts again.
|
||||
pub items_revision: u64,
|
||||
pub selection: Option<usize>,
|
||||
pub multiline: bool,
|
||||
pub readonly: bool,
|
||||
@@ -511,6 +514,7 @@ pub fn parse(d: &Data) -> Result<ScriptUiDialog, HostError> {
|
||||
min,
|
||||
max,
|
||||
items,
|
||||
items_revision: number(field(f, "itemsRevision")).map_or(0, |n| n as u64),
|
||||
selection,
|
||||
multiline: flag("multiline"),
|
||||
readonly: flag("readonly"),
|
||||
|
||||
Reference in new issue
Block a user