(&mut self, declaration: &ElementDeclaration<CustomElementData>)
| 1294 | } |
| 1295 | |
| 1296 | pub fn configure_open_element(&mut self, declaration: &ElementDeclaration<CustomElementData>) { |
| 1297 | if self.boolean_warnings.max_elements_exceeded { |
| 1298 | return; |
| 1299 | } |
| 1300 | let open_idx = self.get_open_layout_element(); |
| 1301 | let layout_config_index = self.store_layout_config(declaration.layout); |
| 1302 | self.layout_elements[open_idx].layout_config_index = layout_config_index; |
| 1303 | |
| 1304 | // Record the start of element configs for this element |
| 1305 | self.layout_elements[open_idx].element_configs.start = self.element_configs.len(); |
| 1306 | |
| 1307 | // Shared config (background color, corner radius, user data) |
| 1308 | let mut shared_config_index: Option<usize> = None; |
| 1309 | if declaration.background_color.a > 0.0 { |
| 1310 | let idx = self.store_shared_config(SharedElementConfig { |
| 1311 | background_color: declaration.background_color, |
| 1312 | corner_radius: CornerRadius::default(), |
| 1313 | user_data: 0, |
| 1314 | }); |
| 1315 | shared_config_index = Some(idx); |
| 1316 | self.attach_element_config(ElementConfigType::Shared, idx); |
| 1317 | } |
| 1318 | if !declaration.corner_radius.is_zero() { |
| 1319 | if let Some(idx) = shared_config_index { |
| 1320 | self.shared_element_configs[idx].corner_radius = declaration.corner_radius; |
| 1321 | } else { |
| 1322 | let idx = self.store_shared_config(SharedElementConfig { |
| 1323 | background_color: Color::rgba(0.0, 0.0, 0.0, 0.0), |
| 1324 | corner_radius: declaration.corner_radius, |
| 1325 | user_data: 0, |
| 1326 | }); |
| 1327 | shared_config_index = Some(idx); |
| 1328 | self.attach_element_config(ElementConfigType::Shared, idx); |
| 1329 | } |
| 1330 | } |
| 1331 | if declaration.user_data != 0 { |
| 1332 | if let Some(idx) = shared_config_index { |
| 1333 | self.shared_element_configs[idx].user_data = declaration.user_data; |
| 1334 | } else { |
| 1335 | let idx = self.store_shared_config(SharedElementConfig { |
| 1336 | background_color: Color::rgba(0.0, 0.0, 0.0, 0.0), |
| 1337 | corner_radius: CornerRadius::default(), |
| 1338 | user_data: declaration.user_data, |
| 1339 | }); |
| 1340 | self.attach_element_config(ElementConfigType::Shared, idx); |
| 1341 | } |
| 1342 | } |
| 1343 | |
| 1344 | // Image config |
| 1345 | if let Some(image_data) = declaration.image_data.clone() { |
| 1346 | self.image_element_configs.push(image_data); |
| 1347 | let idx = self.image_element_configs.len() - 1; |
| 1348 | self.attach_element_config(ElementConfigType::Image, idx); |
| 1349 | } |
| 1350 | |
| 1351 | // Aspect ratio config |
| 1352 | if declaration.aspect_ratio > 0.0 { |
| 1353 | self.aspect_ratio_configs.push(declaration.aspect_ratio); |
no test coverage detected