Skip to content

Commit

Permalink
finished dealing with the updated deps
Browse files Browse the repository at this point in the history
  • Loading branch information
anesthetice committed Sep 17, 2024
1 parent 2c4d36a commit a3adec1
Showing 1 changed file with 77 additions and 25 deletions.
102 changes: 77 additions & 25 deletions crates/rnote-ui/src/penssidebar/shaperpage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ impl RnShaperPage {
shaperstyle_popover.popdown();
}
));

imp.shapeconfig_popover_close_button.connect_clicked(clone!(
#[weak]
shapeconfig_popover,
move |_| {
shapeconfig_popover.popdown();
}),
);
}
));

imp.shapebuildertype_popover_close_button
.connect_clicked(clone!(
#[weak]
Expand Down Expand Up @@ -243,7 +243,13 @@ impl RnShaperPage {
.shaper_config
.smooth_options
.stroke_width = stroke_width;
canvas.engine_mut().pens_config.shaper_config.smooth_options.shape_style.update_inner_strokedash(stroke_width);
canvas
.engine_mut()
.pens_config
.shaper_config
.smooth_options
.shape_style
.update_inner_strokedash(stroke_width);
}
ShaperStyle::Rough => {
canvas
Expand Down Expand Up @@ -314,30 +320,76 @@ impl RnShaperPage {
}
}
}
}),
);
}
));
// Smooth style
// Line cap
imp.smoothstyle_line_cap_row.get().connect_selected_notify(clone!(@weak self as shaperpage, @weak appwindow => move |_| {
let canvas = appwindow.active_tab_wrapper().canvas();
let stroke_width = canvas.engine_ref().pens_config.shaper_config.smooth_options.stroke_width;
let line_cap = shaperpage.smoothstyle_line_cap();
if line_cap == LineCap::Straight && shaperpage.smoothstyle_line_style().is_dotted() {
shaperpage.imp().smoothstyle_line_style_row.set_selected(LineStyle::Solid.to_u32().unwrap())
}
canvas.engine_mut().pens_config.shaper_config.smooth_options.shape_style.update_line_cap(line_cap, stroke_width);
}));
imp.smoothstyle_line_cap_row
.get()
.connect_selected_notify(clone!(
#[weak(rename_to=shaperpage)]
self,
#[weak]
appwindow,
move |_| {
let canvas = appwindow.active_tab_wrapper().canvas();
let stroke_width = canvas
.engine_ref()
.pens_config
.shaper_config
.smooth_options
.stroke_width;
let line_cap = shaperpage.smoothstyle_line_cap();
if line_cap == LineCap::Straight
&& shaperpage.smoothstyle_line_style().is_dotted()
{
shaperpage
.imp()
.smoothstyle_line_style_row
.set_selected(LineStyle::Solid.to_u32().unwrap())
}
canvas
.engine_mut()
.pens_config
.shaper_config
.smooth_options
.shape_style
.update_line_cap(line_cap, stroke_width);
}
));

// Line style
imp.smoothstyle_line_style_row.get().connect_selected_notify(clone!(@weak self as shaperpage, @weak appwindow => move |_| {
let canvas = appwindow.active_tab_wrapper().canvas();
let stroke_width = canvas.engine_ref().pens_config.shaper_config.smooth_options.stroke_width;
let line_style = shaperpage.smoothstyle_line_style();
if line_style.is_dotted() {
shaperpage.imp().smoothstyle_line_cap_row.set_selected(line_style.to_u32().unwrap());
}
canvas.engine_mut().pens_config.shaper_config.smooth_options.shape_style.update_line_style(line_style, stroke_width);
}));
imp.smoothstyle_line_style_row
.get()
.connect_selected_notify(clone!(
#[weak(rename_to=shaperpage)]
self,
#[weak]
appwindow,
move |_| {
let canvas = appwindow.active_tab_wrapper().canvas();
let stroke_width = canvas
.engine_ref()
.pens_config
.shaper_config
.smooth_options
.stroke_width;
let line_style = shaperpage.smoothstyle_line_style();
if line_style.is_dotted() {
shaperpage
.imp()
.smoothstyle_line_cap_row
.set_selected(line_style.to_u32().unwrap());
}
canvas
.engine_mut()
.pens_config
.shaper_config
.smooth_options
.shape_style
.update_line_style(line_style, stroke_width);
}
));

// Rough style
// Fill style
Expand Down

0 comments on commit a3adec1

Please sign in to comment.