This commit is contained in:
Alex Wied
2026-07-12 13:52:13 -04:00
parent 66d21de8fe
commit 54f417c96d
4 changed files with 109 additions and 61 deletions
Generated
+40 -40
View File
@@ -457,18 +457,18 @@ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.25.0" version = "1.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" checksum = "d6aedf8ae72766347502cf3cb4f41cf5e9cc37d28bee90f1fdaaae15f9cf9424"
dependencies = [ dependencies = [
"bytemuck_derive", "bytemuck_derive",
] ]
[[package]] [[package]]
name = "bytemuck_derive" name = "bytemuck_derive"
version = "1.10.2" version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" checksum = "f65693059b6b9c588b9f62fed1cedbf0a8b805631457ea162d68f0de186f3de5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -483,9 +483,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.12.0" version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593" checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
[[package]] [[package]]
name = "calloop" name = "calloop"
@@ -515,9 +515,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.66" version = "1.2.67"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5d6cac793997bd970000024b2934968efe83b382de4fdcf4fcb46b6ee4ad996" checksum = "e17dd265a7d0f31ef544e1b20e03add05d3b45b491b633b10d67145d2acc1a38"
dependencies = [ dependencies = [
"find-msvc-tools", "find-msvc-tools",
"jobserver", "jobserver",
@@ -1631,7 +1631,7 @@ dependencies = [
[[package]] [[package]]
name = "iced" name = "iced"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"iced_core", "iced_core",
"iced_debug", "iced_debug",
@@ -1646,7 +1646,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_core" name = "iced_core"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"bitflags 2.13.0", "bitflags 2.13.0",
"bytes", "bytes",
@@ -1664,7 +1664,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_debug" name = "iced_debug"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"iced_core", "iced_core",
"iced_futures", "iced_futures",
@@ -1674,7 +1674,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_futures" name = "iced_futures"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"futures", "futures",
"iced_core", "iced_core",
@@ -1688,7 +1688,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_graphics" name = "iced_graphics"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"bitflags 2.13.0", "bitflags 2.13.0",
"bytemuck", "bytemuck",
@@ -1706,7 +1706,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_program" name = "iced_program"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"iced_graphics", "iced_graphics",
"iced_runtime", "iced_runtime",
@@ -1715,7 +1715,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_renderer" name = "iced_renderer"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"iced_graphics", "iced_graphics",
"iced_tiny_skia", "iced_tiny_skia",
@@ -1727,7 +1727,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_runtime" name = "iced_runtime"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"bytes", "bytes",
"iced_core", "iced_core",
@@ -1738,7 +1738,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_tiny_skia" name = "iced_tiny_skia"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"cosmic-text", "cosmic-text",
@@ -1754,7 +1754,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_wgpu" name = "iced_wgpu"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"bitflags 2.13.0", "bitflags 2.13.0",
"bytemuck", "bytemuck",
@@ -1771,7 +1771,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_widget" name = "iced_widget"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"iced_renderer", "iced_renderer",
"iced_runtime", "iced_runtime",
@@ -1785,7 +1785,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_winit" name = "iced_winit"
version = "0.15.0-dev" version = "0.15.0-dev"
source = "git+https://github.com/iced-rs/iced.git?branch=master#7c6ce8789c4671db81a3920d06e87ab6d8edef1d" source = "git+https://github.com/iced-rs/iced.git?branch=master#56b706fcd35aa881baede77a696bbb842773fdc6"
dependencies = [ dependencies = [
"arboard", "arboard",
"iced_debug", "iced_debug",
@@ -3290,9 +3290,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.9.4" version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"
dependencies = [ dependencies = [
"rand_chacha", "rand_chacha",
"rand_core", "rand_core",
@@ -3417,9 +3417,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.12.4" version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -3429,9 +3429,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.4.14" version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" checksum = "1f388202e4b80542a0921078cc23b6333bcf1409c1e3f86404cae4766a6131db"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -3541,9 +3541,9 @@ dependencies = [
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.27" version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb"
[[package]] [[package]]
name = "rustc-hash" name = "rustc-hash"
@@ -3606,9 +3606,9 @@ checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
[[package]] [[package]]
name = "ryu-js" name = "ryu-js"
version = "1.0.2" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd29631678d6fb0903b69223673e122c32e9ae559d0960a38d574695ebc0ea15" checksum = "04d056b875a9d2e6cb9a61d127afee9ac5999b9f87bcb32079d1318e505be714"
[[package]] [[package]]
name = "same-file" name = "same-file"
@@ -3712,9 +3712,9 @@ dependencies = [
[[package]] [[package]]
name = "sha1" name = "sha1"
version = "0.10.6" version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"cpufeatures", "cpufeatures",
@@ -4296,9 +4296,9 @@ dependencies = [
[[package]] [[package]]
name = "thread_local" name = "thread_local"
version = "1.1.9" version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
@@ -4383,9 +4383,9 @@ dependencies = [
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.11.0" version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f"
dependencies = [ dependencies = [
"tinyvec_macros", "tinyvec_macros",
] ]
@@ -5734,18 +5734,18 @@ checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.8.53" version = "0.8.54"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75726053136156d419e285b9b7eddaaea9e3fea6ce32eed44a89901f0bd98de1" checksum = "b7cbbc0a705a0fd05cc3676525980d2bf5a9bc4adac6d6475209a7887cf59d19"
dependencies = [ dependencies = [
"zerocopy-derive", "zerocopy-derive",
] ]
[[package]] [[package]]
name = "zerocopy-derive" name = "zerocopy-derive"
version = "0.8.53" version = "0.8.54"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4714fd92cf900833d49538023a9b3915155210801d1c1169eba513b2addefd71" checksum = "e2e817b7b52d0c7358d3246da9d69935ebb18116b2b102b4230dac079b4862f5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
+23
View File
@@ -19,6 +19,7 @@ use oxigraph::io::RdfFormat;
use oxigraph::model::vocab::{rdf, rdfs}; use oxigraph::model::vocab::{rdf, rdfs};
use oxigraph::model::{BaseDirection, BlankNode, Dataset, NamedNode, NamedNodeRef, NamedOrBlankNode, Quad, Term, Triple}; use oxigraph::model::{BaseDirection, BlankNode, Dataset, NamedNode, NamedNodeRef, NamedOrBlankNode, Quad, Term, Triple};
use tracing::{debug, debug_span, error, info, trace}; use tracing::{debug, debug_span, error, info, trace};
use crate::app::Message::URLInputSubmitted;
use crate::rdf::language; use crate::rdf::language;
use crate::rdf::vocab::rda; use crate::rdf::vocab::rda;
use crate::widget::iri_input::iri_input; use crate::widget::iri_input::iri_input;
@@ -57,6 +58,8 @@ pub(crate) enum Message {
HideOverwriteConfirmationModal, HideOverwriteConfirmationModal,
ConfirmOverwrite, ConfirmOverwrite,
NewDocument(NamedNode), NewDocument(NamedNode),
NavigateToPredicate(QuadKey),
NavigateToObject(QuadKey),
ResetState, ResetState,
} }
@@ -332,6 +335,9 @@ impl Publisher {
SearchResultClickAction::URLInput => None, SearchResultClickAction::URLInput => None,
}; };
if let Some(search_state) = &mut self.search_state {
search_state.action = action;
} else {
let (id, window_task) = window::open(Settings::default()); let (id, window_task) = window::open(Settings::default());
self.search_state = Some(SearchState { self.search_state = Some(SearchState {
window_id: id, window_id: id,
@@ -341,6 +347,7 @@ impl Publisher {
results: Vec::new(), results: Vec::new(),
}); });
task = window_task.map(|_| Message::None); task = window_task.map(|_| Message::None);
}
if let Some(selected_entity_class) = selected_entity_class { if let Some(selected_entity_class) = selected_entity_class {
let selection = self.ontology.info(&selected_entity_class.into_owned(), &*language::ENGLISH_OR_UNTAGGED); let selection = self.ontology.info(&selected_entity_class.into_owned(), &*language::ENGLISH_OR_UNTAGGED);
@@ -525,6 +532,20 @@ impl Publisher {
self.show_new_document_buttons = false; self.show_new_document_buttons = false;
self.show_overwrite_confirmation = false; self.show_overwrite_confirmation = false;
} }
Message::NavigateToPredicate(key) => {
if let Some(quad) = self.document.dataset_mut().quads.get_mut(key) {
self.url_input = quad.predicate.as_str().to_string();
task = Task::done(URLInputSubmitted);
}
}
Message::NavigateToObject(key) => {
if let Some(quad) = self.document.dataset_mut().quads.get_mut(key) {
if let Term::NamedNode(node) = &quad.object {
self.url_input = node.as_str().to_string();
task = Task::done(URLInputSubmitted);
}
}
}
_ => {} _ => {}
} }
task task
@@ -563,6 +584,7 @@ impl Publisher {
} else { } else {
predicate_input_base.on_input(move |value| Message::PredicateUpdated(key, value)) predicate_input_base.on_input(move |value| Message::PredicateUpdated(key, value))
.on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Predicate(key))) .on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Predicate(key)))
.on_shift_click(Message::NavigateToPredicate(key))
}; };
let term = TermHelper::new(&triple.object); let term = TermHelper::new(&triple.object);
@@ -592,6 +614,7 @@ impl Publisher {
object_input_base.align_x(value_alignment) object_input_base.align_x(value_alignment)
.on_input(move |value| Message::ObjectUpdated(key, value)) .on_input(move |value| Message::ObjectUpdated(key, value))
.on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Object(key))) .on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Object(key)))
.on_shift_click(Message::NavigateToObject(key))
}; };
let selected_datatype = term.datatype().map(|node| self.ontology.abbreviate(node)); let selected_datatype = term.datatype().map(|node| self.ontology.abbreviate(node));
+9 -4
View File
@@ -1,7 +1,7 @@
use crate::error; use crate::error;
use crate::rdf::vocab::gl; use crate::rdf::vocab::gl;
use oxigraph::model::vocab::{rdf, rdfs, xsd}; use oxigraph::model::vocab::{rdf, rdfs, xsd};
use oxigraph::model::{Dataset, LiteralRef, NamedNode, NamedNodeRef, NamedOrBlankNode, NamedOrBlankNodeRef, Term, TermRef, Triple, TripleRef}; use oxigraph::model::{Dataset, Graph, LiteralRef, NamedNode, NamedNodeRef, NamedOrBlankNode, NamedOrBlankNodeRef, Term, TermRef, Triple, TripleRef};
use oxigraph::sparql::{QueryResults, SparqlEvaluator}; use oxigraph::sparql::{QueryResults, SparqlEvaluator};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::fmt::Display; use std::fmt::Display;
@@ -327,12 +327,17 @@ WHERE {{
pub fn exclude_read_only(&self) -> impl Fn(TripleRef<'_>) -> bool + 'static { pub fn exclude_read_only(&self) -> impl Fn(TripleRef<'_>) -> bool + 'static {
let true_term = TermRef::Literal(LiteralRef::new_typed_literal("true", xsd::BOOLEAN)); let true_term = TermRef::Literal(LiteralRef::new_typed_literal("true", xsd::BOOLEAN));
let dataset = self.store let read_only_graph = self.store
.quads_for_pattern(None, Some(gl::READ_ONLY), Some(true_term), None) .quads_for_pattern(None, Some(gl::READ_ONLY), Some(true_term), None)
.filter_map(Result::ok) .filter_map(Result::ok)
.collect::<Dataset>(); .map(Triple::from)
.collect::<Graph>();
move |triple| { move |triple| {
dataset.quads_for_subject(triple.subject).count() == 0 if triple.predicate == rdf::TYPE && let TermRef::NamedNode(class) = triple.object {
read_only_graph.triples_for_subject(class).count() == 0
} else {
read_only_graph.triples_for_subject(triple.predicate).count() == 0
}
} }
} }
+26 -6
View File
@@ -10,6 +10,7 @@ use iced::widget::text_input::Catalog;
pub struct State { pub struct State {
control: bool, control: bool,
shift: bool,
} }
pub struct IriInput<'a, Message, Theme, Renderer> pub struct IriInput<'a, Message, Theme, Renderer>
@@ -19,6 +20,7 @@ where
{ {
prefixes: &'a BTreeMap<String, String>, prefixes: &'a BTreeMap<String, String>,
on_control_click: Option<Message>, on_control_click: Option<Message>,
on_shift_click: Option<Message>,
text_input: widget::TextInput<'a, Message, Theme, Renderer>, text_input: widget::TextInput<'a, Message, Theme, Renderer>,
} }
@@ -50,6 +52,7 @@ where
Self { Self {
prefixes, prefixes,
on_control_click: None, on_control_click: None,
on_shift_click: None,
text_input, text_input,
} }
} }
@@ -64,6 +67,11 @@ where
self self
} }
pub fn on_shift_click(mut self, on_shift_click: Message) -> Self {
self.on_shift_click = Some(on_shift_click);
self
}
pub fn on_input(mut self, on_input: impl Fn(String) -> Message + 'a) -> Self { pub fn on_input(mut self, on_input: impl Fn(String) -> Message + 'a) -> Self {
let wrapped = move |value: String| { let wrapped = move |value: String| {
let expanded_value = expand(self.prefixes, &value); let expanded_value = expand(self.prefixes, &value);
@@ -126,6 +134,7 @@ where
fn state(&self) -> tree::State { fn state(&self) -> tree::State {
tree::State::new(State { tree::State::new(State {
control: false, control: false,
shift: false,
}) })
} }
@@ -139,12 +148,20 @@ where
match event { match event {
Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => { Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => {
state.control = modifiers.control(); state.control = modifiers.control();
state.shift = modifiers.shift();
} }
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => { Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => {
if cursor.is_over(layout.bounds()) && state.control && let Some(on_control_click) = &self.on_control_click { if cursor.is_over(layout.bounds()) {
if state.control && let Some(on_control_click) = &self.on_control_click {
shell.publish(on_control_click.clone()); shell.publish(on_control_click.clone());
shell.capture_event(); shell.capture_event();
} }
if state.shift && let Some(on_shift_click) = &self.on_shift_click {
shell.publish(on_shift_click.clone());
shell.capture_event();
}
}
} }
_ => {} _ => {}
} }
@@ -154,10 +171,13 @@ where
fn mouse_interaction(&self, tree: &Tree, layout: Layout<'_>, cursor: Cursor, viewport: &Rectangle, renderer: &Renderer) -> Interaction { fn mouse_interaction(&self, tree: &Tree, layout: Layout<'_>, cursor: Cursor, viewport: &Rectangle, renderer: &Renderer) -> Interaction {
let state = tree.state.downcast_ref::<State>(); let state = tree.state.downcast_ref::<State>();
if cursor.is_over(layout.bounds()) && state.control { let interaction = if cursor.is_over(layout.bounds()) {
Interaction::Pointer if (state.control && self.on_control_click.is_some()) ||
} else { (state.shift && self.on_shift_click.is_some()) {
Widget::mouse_interaction(&self.text_input, tree, layout, cursor, viewport, renderer) Some(Interaction::Pointer)
} } else { None }
} else { None };
interaction.unwrap_or_else(|| Widget::mouse_interaction(&self.text_input, tree, layout, cursor, viewport, renderer))
} }
} }