Skip to content

Commit

Permalink
Disable link display on web builds
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Nov 22, 2024
1 parent 56279c4 commit 14af029
Showing 1 changed file with 37 additions and 27 deletions.
64 changes: 37 additions & 27 deletions crates/viewer/re_component_ui/src/recording_uri.rs
Original file line number Diff line number Diff line change
@@ -1,40 +1,50 @@
use re_types::components::RecordingUri;
use re_viewer_context::{MaybeMutRef, SystemCommand, SystemCommandSender, ViewerContext};
use re_viewer_context::{MaybeMutRef, ViewerContext};

pub fn singleline_view_recording_uri(
ctx: &ViewerContext<'_>,
_ctx: &ViewerContext<'_>,
ui: &mut egui::Ui,
value: &mut MaybeMutRef<'_, RecordingUri>,
) -> egui::Response {
let value = value.as_ref();

let response = ui
.scope(|ui| {
if ui.style().wrap_mode.is_none() {
ui.style_mut().wrap_mode = Some(if ui.is_sizing_pass() {
egui::TextWrapMode::Extend
} else {
egui::TextWrapMode::Truncate
});
}
#[cfg(not(target_arch = "wasm32"))]
{
use re_viewer_context::{SystemCommand, SystemCommandSender};

let response = ui
.scope(|ui| {
if ui.style().wrap_mode.is_none() {
ui.style_mut().wrap_mode = Some(if ui.is_sizing_pass() {
egui::TextWrapMode::Extend
} else {
egui::TextWrapMode::Truncate
});
}

ui.link(value.uri())
})
.inner;

if response.clicked() {
let data_source = re_data_source::DataSource::from_uri(
re_log_types::FileSource::Uri,
value.uri().to_owned(),
);

ui.link(value.uri())
})
.inner;

if response.clicked() {
let data_source = re_data_source::DataSource::from_uri(
re_log_types::FileSource::Uri,
value.uri().to_owned(),
);

match data_source.stream(None) {
Ok(rx) => ctx
.command_sender
.send_system(SystemCommand::AddReceiver(rx)),
Err(err) => re_log::warn!("Could not open recording URI: {err}"),
match data_source.stream(None) {
Ok(rx) => _ctx
.command_sender
.send_system(SystemCommand::AddReceiver(rx)),
Err(err) => re_log::warn!("Could not open recording URI: {err}"),
}
}

response
}

response
#[cfg(target_arch = "wasm32")]
{
re_viewer_context::UiLayout::List.label(ui, value.uri())
}
}

0 comments on commit 14af029

Please sign in to comment.