mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-26 03:49:11 +00:00
Keep the page menu's Paste enabled; the clipboard is read when Paste runs
The comments look fix gated it on a clipboard check at the right-button press, which missed and broke four paste tests.
This commit is contained in:
@@ -1872,16 +1872,8 @@ pub fn document_area_at(app: &mut PdfCraftApp, index: usize, rect: Rect, ui: &mu
|
||||
view.want_text(&app.session, &visible_pages, &rest_pages);
|
||||
|
||||
find_bar(view, info.pages.len(), rect, tool == QuickTool::EditText && can_modify, ui);
|
||||
// Whether the clipboard holds a picture is asked when the secondary button goes down, and the menu keeps
|
||||
// that answer while it is open.
|
||||
let can_paste_key = egui::Id::new(("can-paste-image", index));
|
||||
let can_paste_image = if ui.input(|i| i.pointer.secondary_pressed()) {
|
||||
let can = app.can_paste_image();
|
||||
ui.data_mut(|d| d.insert_temp(can_paste_key, can));
|
||||
can
|
||||
} else {
|
||||
ui.data(|d| d.get_temp(can_paste_key)).unwrap_or(false)
|
||||
};
|
||||
// The clipboard is read when Paste is invoked, so its menu stays enabled while the document is open.
|
||||
let can_paste_image = true;
|
||||
let doc = app.session.get(doc_id)?;
|
||||
let info = &doc.info;
|
||||
let view = &mut app.views[index];
|
||||
|
||||
Reference in New Issue
Block a user