Skip to content

Commit

Permalink
feat(#3843): Add support for CanvasState.reset (#3844)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nul-led authored Feb 10, 2024
1 parent db91cc2 commit a396d03
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* Add bindings for `RTCPeerConnectionIceErrorEvent`.
[#3835](https://github.com/rustwasm/wasm-bindgen/pull/3835)

* Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`.
[#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844)

--------------------------------------------------------------------------------

## [0.2.91](https://github.com/rustwasm/wasm-bindgen/compare/0.2.90...0.2.91)
Expand Down
7 changes: 7 additions & 0 deletions crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,13 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"]
pub fn stroke_rect(this: &CanvasRenderingContext2d, x: f64, y: f64, w: f64, h: f64);
# [wasm_bindgen (method , structural , js_class = "CanvasRenderingContext2D" , js_name = reset)]
#[doc = "The `reset()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/reset)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"]
pub fn reset(this: &CanvasRenderingContext2d);
# [wasm_bindgen (method , structural , js_class = "CanvasRenderingContext2D" , js_name = restore)]
#[doc = "The `restore()` method."]
#[doc = ""]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,13 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"]
pub fn stroke_rect(this: &OffscreenCanvasRenderingContext2d, x: f64, y: f64, w: f64, h: f64);
# [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = reset)]
#[doc = "The `reset()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/reset)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"]
pub fn reset(this: &OffscreenCanvasRenderingContext2d);
# [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = restore)]
#[doc = "The `restore()` method."]
#[doc = ""]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ interface mixin CanvasState {
// state
undefined save(); // push state on state stack
undefined restore(); // pop state stack and restore state
undefined reset(); // clears the backing buffer, drawing state stack, any defined paths, and styles
};

interface mixin CanvasTransform {
Expand Down

0 comments on commit a396d03

Please sign in to comment.