Skip to content

Commit 96cb770

Browse files
authored
Merge pull request #14 from 10ne1/dev/aratiu/fix-deprecations
Fix web-sys and 2024 edition deprecations
2 parents 2cd2bfd + 627b754 commit 96cb770

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ features = ['Document', 'DomRect', 'Element', 'HtmlElement', 'Node', 'Window', '
2727
wasm-bindgen-test = "^0.3.17"
2828

2929
[dev-dependencies.plotters]
30-
default_features = false
30+
default-features = false
3131
version = "0.3"

src/canvas.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ impl CanvasBackend {
6565
/// Sets the stroke style and line width in the underlying context.
6666
fn set_line_style(&mut self, style: &impl BackendStyle) {
6767
self.context
68-
.set_stroke_style(&make_canvas_color(style.color()));
68+
.set_stroke_style_str(&make_canvas_color(style.color()));
6969
self.context.set_line_width(style.stroke_width() as f64);
7070
}
7171
}
7272

73-
fn make_canvas_color(color: BackendColor) -> JsValue {
73+
fn make_canvas_color(color: BackendColor) -> String {
7474
let (r, g, b) = color.rgb;
7575
let a = color.alpha;
76-
format!("rgba({},{},{},{})", r, g, b, a).into()
76+
format!("rgba({},{},{},{})", r, g, b, a)
7777
}
7878

7979
impl DrawingBackend for CanvasBackend {
@@ -101,7 +101,7 @@ impl DrawingBackend for CanvasBackend {
101101
}
102102

103103
self.context
104-
.set_fill_style(&make_canvas_color(style.color()));
104+
.set_fill_style_str(&make_canvas_color(style.color()));
105105
self.context
106106
.fill_rect(f64::from(point.0), f64::from(point.1), 1.0, 1.0);
107107
Ok(())
@@ -138,7 +138,7 @@ impl DrawingBackend for CanvasBackend {
138138
}
139139
if fill {
140140
self.context
141-
.set_fill_style(&make_canvas_color(style.color()));
141+
.set_fill_style_str(&make_canvas_color(style.color()));
142142
self.context.fill_rect(
143143
f64::from(upper_left.0),
144144
f64::from(upper_left.1),
@@ -190,7 +190,7 @@ impl DrawingBackend for CanvasBackend {
190190
self.context.begin_path();
191191
if let Some(start) = path.next() {
192192
self.context
193-
.set_fill_style(&make_canvas_color(style.color()));
193+
.set_fill_style_str(&make_canvas_color(style.color()));
194194
self.context.move_to(f64::from(start.0), f64::from(start.1));
195195
for next in path {
196196
self.context.line_to(f64::from(next.0), f64::from(next.1));
@@ -213,7 +213,7 @@ impl DrawingBackend for CanvasBackend {
213213
}
214214
if fill {
215215
self.context
216-
.set_fill_style(&make_canvas_color(style.color()));
216+
.set_fill_style_str(&make_canvas_color(style.color()));
217217
} else {
218218
self.set_line_style(style);
219219
}
@@ -281,7 +281,7 @@ impl DrawingBackend for CanvasBackend {
281281
self.context.set_text_align(text_align);
282282

283283
self.context
284-
.set_fill_style(&make_canvas_color(color.clone()));
284+
.set_fill_style_str(&make_canvas_color(color.clone()));
285285
self.context.set_font(&format!(
286286
"{} {}px {}",
287287
style.style().as_str(),

0 commit comments

Comments
 (0)