-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some Path::line is invisible in Canvas #2281
Comments
Thanks for the report! This is a problem in |
@hecrj Is this issue really solved? On adapted MWEuse iced::{
mouse,
widget::{
canvas::{Frame, Geometry, Path, Program, Stroke},
Canvas,
},
Color, Length, Rectangle, Renderer, Theme,
};
fn main() -> iced::Result {
iced::run("", MyApp::update, MyApp::view)
}
#[derive(Default)]
struct MyApp;
impl MyApp {
fn update(&mut self, _message: ()) {}
fn view(&self) -> iced::Element<'_, ()> {
Canvas::new(MyProgram)
.width(Length::Fill)
.height(Length::Fill)
.into()
}
}
struct MyProgram;
impl<Message> Program<Message> for MyProgram {
type State = ();
fn draw(
&self,
_state: &Self::State,
renderer: &Renderer,
_theme: &Theme,
bounds: Rectangle,
_cursor: mouse::Cursor,
) -> Vec<Geometry> {
let mut frame = Frame::new(renderer, bounds.size());
frame.stroke(
&Path::line([0.0, 100.0].into(), [1024.0, 100.0].into()),
Stroke {
style: Color::BLACK.into(),
width: 50.0,
..Default::default()
},
);
vec![frame.into_geometry()]
}
} |
I'm having a similar issue to this. Should we reopen a new issue? Or can we get this issue reopened? I also have no way to change line ends to be square. Edit, ive added a new bug report: #2765 |
Is there an existing issue for this?
Is this issue related to iced?
What happened?
In the clock example, seconds hand disappears when pointing at 0, 15, 30, and 45.

It seems that Path::line will not be drawn when the line is horizontal or vertical. The following code shows this:
However, if we change the code from
to
i.e., move the endpoint down a little bit, then the line is drawn as expected.
What is the expected behavior?
Path::line is drawn for all directions including vertical and horizontal.
Version
master
Operating System
macOS
Do you have any log output?
No response
The text was updated successfully, but these errors were encountered: