maxcountryman_web_sys/features/
gen_TouchInit.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TouchInit)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `TouchInit` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
11    pub type TouchInit;
12}
13impl TouchInit {
14    #[cfg(feature = "EventTarget")]
15    #[doc = "Construct a new `TouchInit`."]
16    #[doc = ""]
17    #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `TouchInit`*"]
18    pub fn new(identifier: i32, target: &EventTarget) -> Self {
19        #[allow(unused_mut)]
20        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
21        ret.identifier(identifier);
22        ret.target(target);
23        ret
24    }
25    #[doc = "Change the `clientX` field of this object."]
26    #[doc = ""]
27    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
28    pub fn client_x(&mut self, val: i32) -> &mut Self {
29        use wasm_bindgen::JsValue;
30        let r = ::js_sys::Reflect::set(
31            self.as_ref(),
32            &JsValue::from("clientX"),
33            &JsValue::from(val),
34        );
35        debug_assert!(
36            r.is_ok(),
37            "setting properties should never fail on our dictionary objects"
38        );
39        let _ = r;
40        self
41    }
42    #[doc = "Change the `clientY` field of this object."]
43    #[doc = ""]
44    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
45    pub fn client_y(&mut self, val: i32) -> &mut Self {
46        use wasm_bindgen::JsValue;
47        let r = ::js_sys::Reflect::set(
48            self.as_ref(),
49            &JsValue::from("clientY"),
50            &JsValue::from(val),
51        );
52        debug_assert!(
53            r.is_ok(),
54            "setting properties should never fail on our dictionary objects"
55        );
56        let _ = r;
57        self
58    }
59    #[doc = "Change the `force` field of this object."]
60    #[doc = ""]
61    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
62    pub fn force(&mut self, val: f32) -> &mut Self {
63        use wasm_bindgen::JsValue;
64        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("force"), &JsValue::from(val));
65        debug_assert!(
66            r.is_ok(),
67            "setting properties should never fail on our dictionary objects"
68        );
69        let _ = r;
70        self
71    }
72    #[doc = "Change the `identifier` field of this object."]
73    #[doc = ""]
74    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
75    pub fn identifier(&mut self, val: i32) -> &mut Self {
76        use wasm_bindgen::JsValue;
77        let r = ::js_sys::Reflect::set(
78            self.as_ref(),
79            &JsValue::from("identifier"),
80            &JsValue::from(val),
81        );
82        debug_assert!(
83            r.is_ok(),
84            "setting properties should never fail on our dictionary objects"
85        );
86        let _ = r;
87        self
88    }
89    #[doc = "Change the `pageX` field of this object."]
90    #[doc = ""]
91    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
92    pub fn page_x(&mut self, val: i32) -> &mut Self {
93        use wasm_bindgen::JsValue;
94        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pageX"), &JsValue::from(val));
95        debug_assert!(
96            r.is_ok(),
97            "setting properties should never fail on our dictionary objects"
98        );
99        let _ = r;
100        self
101    }
102    #[doc = "Change the `pageY` field of this object."]
103    #[doc = ""]
104    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
105    pub fn page_y(&mut self, val: i32) -> &mut Self {
106        use wasm_bindgen::JsValue;
107        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pageY"), &JsValue::from(val));
108        debug_assert!(
109            r.is_ok(),
110            "setting properties should never fail on our dictionary objects"
111        );
112        let _ = r;
113        self
114    }
115    #[doc = "Change the `radiusX` field of this object."]
116    #[doc = ""]
117    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
118    pub fn radius_x(&mut self, val: f32) -> &mut Self {
119        use wasm_bindgen::JsValue;
120        let r = ::js_sys::Reflect::set(
121            self.as_ref(),
122            &JsValue::from("radiusX"),
123            &JsValue::from(val),
124        );
125        debug_assert!(
126            r.is_ok(),
127            "setting properties should never fail on our dictionary objects"
128        );
129        let _ = r;
130        self
131    }
132    #[doc = "Change the `radiusY` field of this object."]
133    #[doc = ""]
134    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
135    pub fn radius_y(&mut self, val: f32) -> &mut Self {
136        use wasm_bindgen::JsValue;
137        let r = ::js_sys::Reflect::set(
138            self.as_ref(),
139            &JsValue::from("radiusY"),
140            &JsValue::from(val),
141        );
142        debug_assert!(
143            r.is_ok(),
144            "setting properties should never fail on our dictionary objects"
145        );
146        let _ = r;
147        self
148    }
149    #[doc = "Change the `rotationAngle` field of this object."]
150    #[doc = ""]
151    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
152    pub fn rotation_angle(&mut self, val: f32) -> &mut Self {
153        use wasm_bindgen::JsValue;
154        let r = ::js_sys::Reflect::set(
155            self.as_ref(),
156            &JsValue::from("rotationAngle"),
157            &JsValue::from(val),
158        );
159        debug_assert!(
160            r.is_ok(),
161            "setting properties should never fail on our dictionary objects"
162        );
163        let _ = r;
164        self
165    }
166    #[doc = "Change the `screenX` field of this object."]
167    #[doc = ""]
168    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
169    pub fn screen_x(&mut self, val: i32) -> &mut Self {
170        use wasm_bindgen::JsValue;
171        let r = ::js_sys::Reflect::set(
172            self.as_ref(),
173            &JsValue::from("screenX"),
174            &JsValue::from(val),
175        );
176        debug_assert!(
177            r.is_ok(),
178            "setting properties should never fail on our dictionary objects"
179        );
180        let _ = r;
181        self
182    }
183    #[doc = "Change the `screenY` field of this object."]
184    #[doc = ""]
185    #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"]
186    pub fn screen_y(&mut self, val: i32) -> &mut Self {
187        use wasm_bindgen::JsValue;
188        let r = ::js_sys::Reflect::set(
189            self.as_ref(),
190            &JsValue::from("screenY"),
191            &JsValue::from(val),
192        );
193        debug_assert!(
194            r.is_ok(),
195            "setting properties should never fail on our dictionary objects"
196        );
197        let _ = r;
198        self
199    }
200    #[cfg(feature = "EventTarget")]
201    #[doc = "Change the `target` field of this object."]
202    #[doc = ""]
203    #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `TouchInit`*"]
204    pub fn target(&mut self, val: &EventTarget) -> &mut Self {
205        use wasm_bindgen::JsValue;
206        let r =
207            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("target"), &JsValue::from(val));
208        debug_assert!(
209            r.is_ok(),
210            "setting properties should never fail on our dictionary objects"
211        );
212        let _ = r;
213        self
214    }
215}