mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 19:51:26 -05:00
Edit Toolbar and DWG export keep their behavior on the new craft-libs
- Tools panel and toolbars: a click on a toolbar's Edit Toolbar button while the drawer is open beside another toolbar takes the drawer there again. The rail now also reports the button's response from its measuring pass, so the click ran window.editToolbar twice in one frame and the second run closed the drawer. The command runs only from the pass that shows the rail. - DWG export: craft-dwg now also writes R13 and R14. DWG export still offers 2000 to 2018 and refuses R12, R13 and R14 with the same message. - Blend Options: the Ramp test expects the number field to keep its focus when another blend is selected, as SliderField::edit_target keeps it. The draft is still dropped and nothing is committed to the new blend.
This commit is contained in:
@@ -245,9 +245,11 @@ fn convert(bytes: &[u8]) -> Result<Converted, String> {
|
||||
Ok(Converted { dxf, notes: notes.iter().map(|n| worded(n)).collect() })
|
||||
}
|
||||
|
||||
/// Can a DWG file of `version` be written? craft-dwg writes 2000, 2004, 2007, 2010, 2013 and 2018.
|
||||
/// Can a DWG file of `version` be written? DWG export writes 2000, 2004, 2007, 2010, 2013 and 2018. craft-dwg also
|
||||
/// writes R13 and R14, which DWG export does not offer yet.
|
||||
pub fn writes(version: crate::DxfVersion) -> bool {
|
||||
craft_dwg::VERSIONS.iter().any(|(code, _)| *code == version.acadver())
|
||||
!matches!(version, crate::DxfVersion::R12 | crate::DxfVersion::R13 | crate::DxfVersion::R14)
|
||||
&& craft_dwg::VERSIONS.iter().any(|(code, _)| *code == version.acadver())
|
||||
}
|
||||
|
||||
/// A DWG file of `version` from `dxf`, an ASCII DXF of that version as [`crate::export_drawings`]
|
||||
|
||||
@@ -634,7 +634,9 @@ fn a_secondary_press_on_ramp_while_selecting_another_blend_drops_its_draft_witho
|
||||
Event::PointerMoved(ramp),
|
||||
Event::PointerButton { pos: ramp, button: PointerButton::Secondary, pressed: true, modifiers: Modifiers::NONE },
|
||||
]);
|
||||
assert!(!p.focused_role("Ramp:", Role::SPIN_BUTTON), "a secondary press does not focus Ramp's number field");
|
||||
// The number field keeps the focus it had while the draft was typed: a new edit target drops the draft, not the
|
||||
// focus, and a secondary press moves neither.
|
||||
assert!(p.focused_role("Ramp:", Role::SPIN_BUTTON), "Ramp's number field keeps the focus");
|
||||
assert!(!p.focused_role("Ramp:", Role::SLIDER), "a secondary press does not focus Ramp's track");
|
||||
p.frame_with(vec![Event::PointerButton { pos: ramp, button: PointerButton::Secondary, pressed: false, modifiers: Modifiers::NONE }]);
|
||||
p.key(Key::Enter, Modifiers::NONE);
|
||||
|
||||
@@ -507,7 +507,8 @@ fn show_rail(app: &mut VectorcraftApp, ui: &mut Ui, owner: Owner, at: GroupAt, m
|
||||
// Tools without options answer with an error; a double click on one does nothing more.
|
||||
app.run("tool.options", json!({ "tool": tool })).ok();
|
||||
}
|
||||
if out.edit_toolbar.as_ref().is_some_and(|button| button.clicked()) {
|
||||
// A measuring pass of the rail reports the same click as the pass that shows it, and the command toggles the drawer.
|
||||
if out.edit_toolbar.as_ref().is_some_and(|button| button.clicked()) && !craft::ui::runtime::measure::active(ui.ctx()) {
|
||||
let params = match &owner {
|
||||
Owner::Toolbar(id) => json!({ "toolbar": bar_of(&app.ui, *id).map(|bar| bar.name.clone()) }),
|
||||
_ => json!({}),
|
||||
|
||||
Reference in New Issue
Block a user