mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-26 04:58:07 +00:00
pipe fill_sign-2: fixes for fill_sign (7 tests)
This commit is contained in:
@@ -447,7 +447,8 @@ pub(crate) fn parts(
|
||||
return vec![PagePart::new(owner, page, shape, PageLayer::Comment).context_only()];
|
||||
}
|
||||
let tip = tips(info, prefs, tool).into_iter().find(|(t, _)| *t == id).map(|(_, tip)| tip);
|
||||
let part = PagePart::new(owner, page, shape, PageLayer::Comment).passes_drag().cursor(icon);
|
||||
let layer = if engine(info, page, index).is_some_and(|a| a.fill_sign) { PageLayer::Placed } else { PageLayer::Comment };
|
||||
let part = PagePart::new(owner, page, shape, layer).passes_drag().cursor(icon);
|
||||
vec![match tip {
|
||||
Some(tip) => part.tip_now(tip),
|
||||
None => part,
|
||||
|
||||
@@ -14,7 +14,7 @@ use craft::ui::contract::{ActivateOn, Bind, CollectionEvent, Props as _, SelectM
|
||||
use craft::ui::list::ThumbAspect;
|
||||
use craft::ui::primitives::Draw;
|
||||
use craft::ui::style::DataColor;
|
||||
use craft::ui::tile_grid::{Tile, TileActionPlace, TileGrid};
|
||||
use craft::ui::tile_grid::{Tile, TileActionPlace, TileGrid, TilePartEvent};
|
||||
use egui::Pos2;
|
||||
use pdfcraft_engine::{BorderShape, Edit, FillMark, NewAnnotation, Rgb, Shape, Style};
|
||||
use pdfcraft_render::{DocInfo, PageInfo};
|
||||
@@ -549,13 +549,16 @@ pub(crate) fn signature_entries(ui: &mut egui::Ui, app: &mut crate::PdfCraftApp)
|
||||
.thumb(ThumbAspect::new(3, 1), move |cx, rect| {
|
||||
cx.with_draw(|draw| paint_signature(cx.painter.ctx(), draw, rect, saved, DataColor::new(cx.ink())));
|
||||
})
|
||||
.action(IconId::new("pencil"), CommandRef::new(slot.change_id))
|
||||
.action(IconId::new("x"), CommandRef::new(slot.remove_id))
|
||||
.action_named(IconId::new("pencil"), CommandRef::new(slot.change_id), ctx_less_label("Change {what}", slot.what))
|
||||
.action_named(IconId::new("x"), CommandRef::new(slot.remove_id), ctx_less_label("Remove saved {what}", slot.what))
|
||||
});
|
||||
for event in out.response.events {
|
||||
if let CollectionEvent::Activate(key) = event {
|
||||
command = shown.get(key).map(|s| s.use_id);
|
||||
}
|
||||
command = match event {
|
||||
CollectionEvent::Activate(key) => shown.get(key).map(|s| s.use_id),
|
||||
CollectionEvent::Item(key, TilePartEvent::Action(0)) => shown.get(key).map(|s| s.change_id),
|
||||
CollectionEvent::Item(key, TilePartEvent::Action(1)) => shown.get(key).map(|s| s.remove_id),
|
||||
_ => command,
|
||||
};
|
||||
}
|
||||
command
|
||||
}
|
||||
|
||||
@@ -2024,10 +2024,10 @@ fn settle_scan(h: &mut Harness<'static, PdfCraftApp>) -> bool {
|
||||
/// Draw a new scan frame on the pad's photo from one point of the photo (800 × 600) to another.
|
||||
fn drag_frame(h: &mut Harness<'static, PdfCraftApp>, from: (f32, f32), to: (f32, f32)) -> bool {
|
||||
let area = h.get_by_label("Photo").rect();
|
||||
let fit = area.shrink(8.0);
|
||||
let scale = (fit.width() / 800.0).min(fit.height() / 600.0);
|
||||
let origin = fit.center() - egui::vec2(400.0, 300.0) * scale;
|
||||
let to_screen = |p: (f32, f32)| origin + egui::vec2(p.0, p.1) * scale;
|
||||
let mut view = craft::behavior::CanvasView::new(area, craft::behavior::kurbo::Point::ORIGIN, 1.0);
|
||||
let target = craft::ui::canvas::ViewTarget::new(craft::behavior::kurbo::Size::new(800.0, 600.0));
|
||||
craft::ui::canvas::ViewCommands::FitOnScreen.apply(&mut view, &target, None, h.ctx.pixels_per_point());
|
||||
let to_screen = |p: (f32, f32)| view.to_screen(craft::behavior::kurbo::Point::new(f64::from(p.0), f64::from(p.1)));
|
||||
let (a, b) = (to_screen(from), to_screen(to));
|
||||
h.hover_at(a);
|
||||
h.run_steps(1);
|
||||
@@ -2785,10 +2785,7 @@ fn typing_a_fill_text_size_that_rounds_to_the_stored_one_adds_no_undo_step() {
|
||||
h.get_by_label("Font size").click();
|
||||
h.run_steps(2);
|
||||
let type_size = |h: &mut Harness<'static, PdfCraftApp>, value: &str| {
|
||||
h.query_all_by_role(egui::accesskit::Role::SpinButton)
|
||||
.find(|n| n.value().is_some_and(|v| v.ends_with(" pt")))
|
||||
.expect("the Font size control")
|
||||
.click();
|
||||
h.get_by_role_and_label(egui::accesskit::Role::SpinButton, "Font size").click();
|
||||
h.run_steps(2);
|
||||
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
|
||||
h.event(egui::Event::Text(value.into()));
|
||||
|
||||
Reference in New Issue
Block a user