mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-01 17:38:13 +08:00
Fix DropdownInput widget not reactively updating when its content changes (#2770)
* Improve reactivity of DropdownInput.svelte * Fix formatting lint --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
62c7f88f5b
commit
532e913017
@@ -30,6 +30,7 @@
|
|||||||
let open = false;
|
let open = false;
|
||||||
|
|
||||||
$: watchSelectedIndex(selectedIndex);
|
$: watchSelectedIndex(selectedIndex);
|
||||||
|
$: watchEntries(entries);
|
||||||
$: watchActiveEntry(activeEntry);
|
$: watchActiveEntry(activeEntry);
|
||||||
$: watchOpen(open);
|
$: watchOpen(open);
|
||||||
|
|
||||||
@@ -38,7 +39,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Called only when `selectedIndex` is changed from outside this component
|
// Called only when `selectedIndex` is changed from outside this component
|
||||||
function watchSelectedIndex(_?: number) {
|
function watchSelectedIndex(_?: typeof selectedIndex) {
|
||||||
|
activeEntrySkipWatcher = true;
|
||||||
|
activeEntry = makeActiveEntry();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called only when `entries` is changed from outside this component
|
||||||
|
function watchEntries(_?: typeof entries) {
|
||||||
activeEntrySkipWatcher = true;
|
activeEntrySkipWatcher = true;
|
||||||
activeEntry = makeActiveEntry();
|
activeEntry = makeActiveEntry();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,7 +291,15 @@ pub fn migrate_image_frame<'de, D: serde::Deserializer<'de>>(deserializer: D) ->
|
|||||||
*image_frame_table.instance_mut_iter().next().unwrap().alpha_blending = alpha_blending;
|
*image_frame_table.instance_mut_iter().next().unwrap().alpha_blending = alpha_blending;
|
||||||
image_frame_table
|
image_frame_table
|
||||||
}
|
}
|
||||||
FormatVersions::ImageFrame(image_frame) => RasterDataTable::new(Raster::new_cpu(image_frame.instance_ref_iter().next().unwrap().instance.image.clone())),
|
FormatVersions::ImageFrame(image_frame) => RasterDataTable::new(Raster::new_cpu(
|
||||||
|
image_frame
|
||||||
|
.instance_ref_iter()
|
||||||
|
.next()
|
||||||
|
.unwrap_or(Instances::new(ImageFrame::default()).instance_ref_iter().next().unwrap())
|
||||||
|
.instance
|
||||||
|
.image
|
||||||
|
.clone(),
|
||||||
|
)),
|
||||||
FormatVersions::ImageFrameTable(image_frame_table) => RasterDataTable::new(Raster::new_cpu(image_frame_table.instance_ref_iter().next().unwrap().instance.clone())),
|
FormatVersions::ImageFrameTable(image_frame_table) => RasterDataTable::new(Raster::new_cpu(image_frame_table.instance_ref_iter().next().unwrap().instance.clone())),
|
||||||
FormatVersions::RasterDataTable(raster_data_table) => raster_data_table,
|
FormatVersions::RasterDataTable(raster_data_table) => raster_data_table,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user