Merge branch 'master' into beacon
This commit is contained in:
commit
ebfcb65841
41 changed files with 805 additions and 589 deletions
|
|
@ -150,12 +150,12 @@ impl<Message> canvas::Program<Message> for Clock {
|
|||
-width * 2.0,
|
||||
),
|
||||
color: palette.secondary.strong.text,
|
||||
horizontal_alignment: if rotate_factor > 0.0 {
|
||||
align_x: if rotate_factor > 0.0 {
|
||||
alignment::Horizontal::Right
|
||||
} else {
|
||||
alignment::Horizontal::Left
|
||||
},
|
||||
vertical_alignment: alignment::Vertical::Bottom,
|
||||
align_y: alignment::Vertical::Bottom,
|
||||
font: Font::MONOSPACE,
|
||||
..canvas::Text::default()
|
||||
});
|
||||
|
|
@ -173,8 +173,8 @@ impl<Message> canvas::Program<Message> for Clock {
|
|||
size: (radius / 5.0).into(),
|
||||
position: Point::new(x * 0.82, y * 0.82),
|
||||
color: palette.secondary.strong.text,
|
||||
horizontal_alignment: alignment::Horizontal::Center,
|
||||
vertical_alignment: alignment::Vertical::Center,
|
||||
align_x: alignment::Horizontal::Center,
|
||||
align_y: alignment::Vertical::Center,
|
||||
font: Font::MONOSPACE,
|
||||
..canvas::Text::default()
|
||||
});
|
||||
|
|
|
|||
|
|
@ -170,8 +170,8 @@ impl Theme {
|
|||
});
|
||||
|
||||
let mut text = canvas::Text {
|
||||
horizontal_alignment: alignment::Horizontal::Center,
|
||||
vertical_alignment: alignment::Vertical::Top,
|
||||
align_x: alignment::Horizontal::Center,
|
||||
align_y: alignment::Vertical::Top,
|
||||
size: Pixels(15.0),
|
||||
color: text_color,
|
||||
..canvas::Text::default()
|
||||
|
|
@ -214,7 +214,7 @@ impl Theme {
|
|||
});
|
||||
}
|
||||
|
||||
text.vertical_alignment = alignment::Vertical::Bottom;
|
||||
text.align_y = alignment::Vertical::Bottom;
|
||||
|
||||
let hsl = Hsl::from_color(Rgb::from(self.base));
|
||||
for i in 0..self.len() {
|
||||
|
|
|
|||
|
|
@ -580,8 +580,8 @@ mod grid {
|
|||
color: Color::WHITE,
|
||||
size: 14.0.into(),
|
||||
position: Point::new(frame.width(), frame.height()),
|
||||
horizontal_alignment: alignment::Horizontal::Right,
|
||||
vertical_alignment: alignment::Vertical::Bottom,
|
||||
align_x: alignment::Horizontal::Right,
|
||||
align_y: alignment::Vertical::Bottom,
|
||||
..Text::default()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -72,10 +72,9 @@ pub fn main() -> Result<(), winit::error::EventLoopError> {
|
|||
);
|
||||
let clipboard = Clipboard::connect(window.clone());
|
||||
|
||||
let backend =
|
||||
wgpu::util::backend_bits_from_env().unwrap_or_default();
|
||||
let backend = wgpu::Backends::from_env().unwrap_or_default();
|
||||
|
||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
||||
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
|
||||
backends: backend,
|
||||
..Default::default()
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
0ef7325a79ce31c83759529ed478c8b4848c40c2867193624ef9673b9e21ff53
|
||||
0e355b080ad33905145e9f70a3b29e2481197c8fc8f42491acd5358238ebbd5f
|
||||
|
|
@ -11,6 +11,7 @@ iced.features = ["image", "debug"]
|
|||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
tracing-subscriber = "0.3"
|
||||
open = "5"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
iced.workspace = true
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
use iced::border;
|
||||
use iced::widget::{Button, Column, Container, Slider};
|
||||
use iced::widget::{
|
||||
button, center_x, center_y, checkbox, column, horizontal_space, image,
|
||||
radio, row, scrollable, slider, text, text_input, toggler, vertical_space,
|
||||
radio, rich_text, row, scrollable, slider, span, text, text_input, toggler,
|
||||
vertical_space,
|
||||
};
|
||||
use iced::{Center, Color, Element, Fill, Font, Pixels};
|
||||
use iced::{Center, Color, Element, Fill, Font, Pixels, Theme};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
|
@ -54,6 +56,7 @@ pub enum Message {
|
|||
ToggleTextInputIcon(bool),
|
||||
DebugToggled(bool),
|
||||
TogglerChanged(bool),
|
||||
OpenTrunk,
|
||||
}
|
||||
|
||||
impl Tour {
|
||||
|
|
@ -130,6 +133,10 @@ impl Tour {
|
|||
Message::TogglerChanged(toggler) => {
|
||||
self.toggler = toggler;
|
||||
}
|
||||
Message::OpenTrunk => {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let _ = open::that_in_background("https://trunkrs.dev");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -194,8 +201,8 @@ impl Tour {
|
|||
fn welcome(&self) -> Column<Message> {
|
||||
Self::container("Welcome!")
|
||||
.push(
|
||||
"This is a simple tour meant to showcase a bunch of widgets \
|
||||
that can be easily implemented on top of Iced.",
|
||||
"This is a simple tour meant to showcase a bunch of \
|
||||
widgets that can be easily implemented on top of Iced.",
|
||||
)
|
||||
.push(
|
||||
"Iced is a cross-platform GUI library for Rust focused on \
|
||||
|
|
@ -210,13 +217,31 @@ impl Tour {
|
|||
built on top of wgpu, a graphics library supporting Vulkan, \
|
||||
Metal, DX11, and DX12.",
|
||||
)
|
||||
.push({
|
||||
let theme = Theme::default();
|
||||
let palette = theme.extended_palette();
|
||||
|
||||
rich_text![
|
||||
"Additionally, this tour can also run on WebAssembly ",
|
||||
"by leveraging ",
|
||||
span("trunk")
|
||||
.color(palette.primary.base.color)
|
||||
.background(palette.background.weakest.color)
|
||||
.border(
|
||||
border::rounded(2)
|
||||
.width(1)
|
||||
.color(palette.background.weak.color)
|
||||
)
|
||||
.padding([0, 2])
|
||||
.font(Font::MONOSPACE)
|
||||
.link(Message::OpenTrunk),
|
||||
"."
|
||||
]
|
||||
.on_link_click(std::convert::identity)
|
||||
})
|
||||
.push(
|
||||
"Additionally, this tour can also run on WebAssembly thanks \
|
||||
to dodrio, an experimental VDOM library for Rust.",
|
||||
)
|
||||
.push(
|
||||
"You will need to interact with the UI in order to reach the \
|
||||
end!",
|
||||
"You will need to interact with the UI in order to reach \
|
||||
the end!",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,8 +142,8 @@ impl<Message> canvas::Program<Message> for State {
|
|||
} else {
|
||||
"Vectorial Text! 🎉"
|
||||
}),
|
||||
horizontal_alignment: alignment::Horizontal::Center,
|
||||
vertical_alignment: alignment::Vertical::Center,
|
||||
align_x: alignment::Horizontal::Center,
|
||||
align_y: alignment::Vertical::Center,
|
||||
shaping: text::Shaping::Advanced,
|
||||
..canvas::Text::default()
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue