mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-01 10:51:11 +01:00
Restore native save dialogs, selected Hand panning and font list space
This commit is contained in:
1 parent
acaa80fc42
commit
1b1dc76f7d
7 files changed
+18
-4
No files matched your search
@@ -804,7 +804,7 @@ fn main() -> std::process::ExitCode {
|
||||
};
|
||||
let (files, file_panels) = file_service(wake, folders);
|
||||
let files = Arc::new(files);
|
||||
craft::host::Host::builder(AppInfo {
|
||||
let host = craft::host::Host::builder(AppInfo {
|
||||
id: vectorcraft_ui_egui::os_window::SETTINGS_APP_ID,
|
||||
name: vectorcraft_ui_egui::os_window::name(),
|
||||
version: vectorcraft_ui_egui::os_window::version(),
|
||||
@@ -812,7 +812,8 @@ fn main() -> std::process::ExitCode {
|
||||
.i18n(vectorcraft_ui_egui::i18n::shared())
|
||||
.settings(Arc::new(settings.clone()))
|
||||
.files(files.clone())
|
||||
.install(ctx);
|
||||
.build();
|
||||
host.clone().install(ctx);
|
||||
let mut session = Session::new();
|
||||
// The profiles loaded before come back before the preferences name any of them.
|
||||
prefs_dir::attach_profile_store(&mut session);
|
||||
@@ -837,6 +838,7 @@ fn main() -> std::process::ExitCode {
|
||||
prefs_dir::attach_proof_setups(&mut session);
|
||||
prefs_dir::attach_script_data(&mut session);
|
||||
let mut app = VectorcraftApp::new(session, services(winit_window.clone()));
|
||||
app.host = Arc::new(host);
|
||||
app.adopt_context(&cc.egui_ctx);
|
||||
// A nightly is updated by the Launcher: it never checks for a stable release, which
|
||||
// would install this program's own updater over the nightly build.
|
||||
|
||||
@@ -138,6 +138,7 @@ impl VectorcraftApp {
|
||||
spelling: Default::default(),
|
||||
text_nodes: Default::default(),
|
||||
momentary: None,
|
||||
hand: None,
|
||||
selection_box: None,
|
||||
selection_bounds: None,
|
||||
selection_marks: None,
|
||||
|
||||
@@ -77,6 +77,7 @@ pub struct CanvasCache {
|
||||
/// The Hand, Zoom and Rotate View tools the Space key and its chords lend the canvas, between
|
||||
/// passes; the tool adapter takes it out for its call and puts it back.
|
||||
pub momentary: Option<craft::ui::canvas::Momentary>,
|
||||
pub hand: Option<craft::ui::canvas::HandTool>,
|
||||
/// [`VectorcraftApp::selection_box`] for (document uid, revision, Use Preview Bounds and
|
||||
/// Measure Type by Glyph Bounds).
|
||||
pub selection_box: Option<((u64, u64, vectorcraft_effects::preview::Measure), Option<vectorcraft_doc::OrientedBox>)>,
|
||||
|
||||
@@ -127,10 +127,12 @@ fn a_hand_drag_held_near_the_edge_does_not_scroll_on() {
|
||||
let (mut app, ctx, _) = zoomed_in("hand");
|
||||
let rect = app.canvas_view().unwrap().rect;
|
||||
let start = rect.center();
|
||||
let before = center(&app);
|
||||
frame(&mut app, &ctx, vec![egui::Event::PointerMoved(start), button(start, true)]);
|
||||
let edge = pos2(rect.right() - 4.0, start.y);
|
||||
frame(&mut app, &ctx, vec![egui::Event::PointerMoved(edge)]);
|
||||
let c0 = center(&app);
|
||||
assert!(c0.x < before.x, "dragging the selected Hand right must pan the view");
|
||||
for _ in 0..3 {
|
||||
frame(&mut app, &ctx, vec![]);
|
||||
}
|
||||
|
||||
@@ -650,7 +650,15 @@ pub(crate) fn run(app: &mut VectorcraftApp, ui: &mut Ui, pass: &ToolPass) -> Too
|
||||
let mut picked = ToolHostResponse::default();
|
||||
let mut response = if crate::dialogs::recolor::edit_tab::with_theme_pick(app, |app, tool| picked = host_run(app, ui, pass, tool)) {
|
||||
picked
|
||||
} else if app.session.tool_id() == "hand" && app.ui.screen_mode != 3 {
|
||||
let options = crate::app::view::navigation(&app.session.prefs);
|
||||
let mut hand = app.canvas.hand.take().unwrap_or_else(|| craft::ui::canvas::HandTool::new(options));
|
||||
hand.options = options;
|
||||
let response = host_run(app, ui, pass, &mut hand);
|
||||
app.canvas.hand = Some(hand);
|
||||
response
|
||||
} else {
|
||||
app.canvas.hand = None;
|
||||
let mut tool = SessionTool::new(app, view_info, ui);
|
||||
let response = host_run_session(&mut tool, ui, pass);
|
||||
drop(tool);
|
||||
|
||||
@@ -114,7 +114,7 @@ pub(crate) fn family_picker<'a>(
|
||||
.filters(filters)
|
||||
.sets(sets)
|
||||
.scripts(&FontScript::ALL)
|
||||
.filter_layout(FilterLayout::Chips)
|
||||
.filter_layout(FilterLayout::Toolbar)
|
||||
}
|
||||
|
||||
/// What one pass of a picker reads of the app, for a host that has no `app` while it draws (a dialog).
|
||||
|
||||
@@ -1231,7 +1231,7 @@ pub(crate) fn controls(app: &mut VectorcraftApp, ui: &mut Ui, rows: CharacterRow
|
||||
.filters(Bind::bound(&mut app.ui.font_filters))
|
||||
.sets(&sets)
|
||||
.scripts(&FontScript::ALL)
|
||||
.filter_layout(FilterLayout::Chips);
|
||||
.filter_layout(FilterLayout::Toolbar);
|
||||
if let Some(text) = &sample {
|
||||
source = source.preview_text(text);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user