Create a WidgetComponent with the given options.
(widget: &W)
| 295 | impl WidgetComponent { |
| 296 | /// Create a WidgetComponent with the given options. |
| 297 | pub fn new<W: WidgetProperties>(widget: &W) -> Self { |
| 298 | let id = widget.key().id(); |
| 299 | let canvas = match widget.parent() { |
| 300 | Some(parent) => { |
| 301 | // options.parent.add(self); |
| 302 | // parent.canvas |
| 303 | } |
| 304 | None => { |
| 305 | // //parent.is_some() |
| 306 | |
| 307 | // if !Std.is(self, Canvas) && canvas.is_none() { |
| 308 | // panic!("WidgetComponent without a canvas {}", _options_); |
| 309 | // } |
| 310 | } |
| 311 | }; |
| 312 | |
| 313 | let depth_offset = widget.depth(); |
| 314 | |
| 315 | let h = widget.h(); |
| 316 | let h_max = widget.h_max(); |
| 317 | let h_min = widget.h_min(); |
| 318 | |
| 319 | let key_input = widget.key_input(); |
| 320 | let mouse_input = widget.mouse_input(); |
| 321 | |
| 322 | let parent = widget.parent(); |
| 323 | let renderable = widget.renderable(); |
| 324 | // let rendering = options.rendering(); //.unwrap_or(canvas.rendering); |
| 325 | |
| 326 | // let user = options.user.unwrap_or_default(); |
| 327 | |
| 328 | let w_min = widget.w_min(); |
| 329 | |
| 330 | let w_max = widget.w_max(); |
| 331 | let x = widget.x(); |
| 332 | let y = widget.y(); |
| 333 | let w = widget.w(); |
| 334 | |
| 335 | let x_local = x; |
| 336 | let y_local = y; |
| 337 | |
| 338 | let instance = Self { |
| 339 | id, |
| 340 | canvas: box None, |
| 341 | children: Vec::new(), |
| 342 | children_bounds: ChildBounds { |
| 343 | x: 0.0, |
| 344 | y: 0.0, |
| 345 | w: 0.0, |
| 346 | h: 0.0, |
| 347 | x_local: 0.0, |
| 348 | y_local: 0.0, |
| 349 | }, |
| 350 | clip: None, |
| 351 | closest_to_canvas: None, |
| 352 | depth: 1.0, |
| 353 | depth_offset, |
| 354 | destroyed: false, |
nothing calls this directly
no test coverage detected