(animate)
| 210 | } |
| 211 | |
| 212 | update_names(animate) { |
| 213 | const that = this; |
| 214 | const names = this.model.get('names') || []; |
| 215 | const show_names = this.model.get('display_names') && names.length !== 0; |
| 216 | const animation_duration = animate |
| 217 | ? this.parent.model.get('animation_duration') |
| 218 | : 0; |
| 219 | |
| 220 | this.d3el |
| 221 | .selectAll('.object_grp') |
| 222 | .select('text') |
| 223 | .text((d: any) => { |
| 224 | return d.name; |
| 225 | }) |
| 226 | .transition('update_names') |
| 227 | .duration(animation_duration) |
| 228 | .attr('transform', (d) => { |
| 229 | const label_display_horizontal_offset = that.model.get( |
| 230 | 'label_display_horizontal_offset' |
| 231 | ); |
| 232 | const label_display_vertical_offset = that.model.get( |
| 233 | 'label_display_vertical_offset' |
| 234 | ); |
| 235 | const text_loc = Math.sqrt(that.get_element_size(d)) / 2.0; |
| 236 | return ( |
| 237 | 'translate(' + |
| 238 | (label_display_horizontal_offset |
| 239 | ? label_display_horizontal_offset |
| 240 | : text_loc) + |
| 241 | ',' + |
| 242 | (label_display_vertical_offset |
| 243 | ? -label_display_vertical_offset |
| 244 | : -text_loc) + |
| 245 | ')' |
| 246 | ); |
| 247 | }) |
| 248 | .attr('display', (d) => { |
| 249 | return show_names ? 'inline' : 'none'; |
| 250 | }); |
| 251 | } |
| 252 | |
| 253 | color_scale_updated(animate) { |
| 254 | const fill = this.model.get('fill'), |
no test coverage detected