mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 14:14:50 +00:00
Save for Web: an Optimize to File Size result stops holding when the selected slices change
This commit is contained in:
@@ -914,11 +914,12 @@ pub(super) fn optimized_result<'a>(d: &'a Dialog, s: Option<&WebSettings>, art:
|
||||
d.fields.get("__optimized").filter(|r| r["art"] == json!(art) && s.is_some_and(|s| r["settings"] == s.to_json()))
|
||||
}
|
||||
|
||||
/// The active document, its revision and its selected objects, which an Optimize to File Size result
|
||||
/// was measured on. The selection decides the slices Save writes with `slices: selected` and the
|
||||
/// slice Current Slice measures, and a selection made on the canvas leaves the revision as it is.
|
||||
/// The active document, its revision and its selected objects and slices, which an Optimize to File
|
||||
/// Size result was measured on. The selection decides the slices Save writes with `slices: selected`
|
||||
/// and the slice Current Slice measures, and a selection made on the canvas or with the Slice
|
||||
/// Selection tool leaves the revision as it is.
|
||||
pub(super) fn art_key(app: &VectorcraftApp) -> String {
|
||||
app.session.active().map_or_else(String::new, |st| format!("{}:{}:{:?}", st.uid, st.revision, st.selection.objects))
|
||||
app.session.active().map_or_else(String::new, |st| format!("{}:{}:{:?}:{:?}", st.uid, st.revision, st.selection.objects, st.selection.slices))
|
||||
}
|
||||
|
||||
/// `bytes` in K, rounded up to the Desired File Size field's 0.001 K so the size it asks for holds
|
||||
|
||||
@@ -783,6 +783,15 @@ fn optimize_to_file_size_takes_the_settings_that_fit() {
|
||||
assert!(!st.selection.objects.is_empty());
|
||||
st.selection.objects.clear();
|
||||
assert!(!shown(&app));
|
||||
// And a change to the selected slices alone (the Slice Selection tool).
|
||||
let mut current = found.clone();
|
||||
current["art"] = json!(save_for_web::art_key(&app));
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("__optimized".into(), current);
|
||||
assert!(shown(&app));
|
||||
let st = app.session.active_mut().unwrap();
|
||||
let any = st.doc.layers[0].id;
|
||||
st.selection.slices.push(any);
|
||||
assert!(!shown(&app));
|
||||
}
|
||||
|
||||
/// Enter while the Optimize to File Size rows are open runs the search and writes nothing; once the
|
||||
|
||||
Reference in New Issue
Block a user