()
| 179 | } |
| 180 | |
| 181 | click_handler() { |
| 182 | const el = d3.select(d3GetEvent().target); |
| 183 | if (this.is_hover_element(el)) { |
| 184 | const data: any = el.data()[0]; |
| 185 | const idx = this.model.get('selected') || []; |
| 186 | const selected = Array.from(idx); |
| 187 | const elem_index = selected.indexOf(data.id); |
| 188 | if (elem_index > -1) { |
| 189 | selected.splice(elem_index, 1); |
| 190 | el.transition('click_handler').style('fill-opacity', 0.0); |
| 191 | this.highlight_g.selectAll('.hovered').remove(); |
| 192 | const choice = '#c'.concat(data.id.toString()); |
| 193 | d3.select(choice).remove(); |
| 194 | } else { |
| 195 | this.highlight_g.selectAll('.hovered').remove(); |
| 196 | this.highlight_g |
| 197 | .append(() => { |
| 198 | return el.node().cloneNode(true); |
| 199 | }) |
| 200 | .attr('id', 'c' + data.id) |
| 201 | .classed('selected', true) |
| 202 | .classed('event_layer', false); |
| 203 | |
| 204 | if ( |
| 205 | this.validate_color(this.model.get('selected_styles').selected_fill) |
| 206 | ) { |
| 207 | this.highlight_g |
| 208 | .selectAll('.selected') |
| 209 | .style('fill-opacity', 1.0) |
| 210 | .style('fill', this.model.get('selected_styles').selected_fill); |
| 211 | } |
| 212 | |
| 213 | if ( |
| 214 | this.validate_color(this.model.get('selected_styles').selected_stroke) |
| 215 | ) { |
| 216 | this.highlight_g |
| 217 | .selectAll('.selected') |
| 218 | .style('stroke', this.model.get('selected_styles').selected_stroke) |
| 219 | .style( |
| 220 | 'stroke-width', |
| 221 | this.model.get('selected_styles').selected_stroke_width |
| 222 | ); |
| 223 | } |
| 224 | selected.push(data.id); |
| 225 | this.model.set('selected', selected); |
| 226 | this.touch(); |
| 227 | } |
| 228 | this.model.set('selected', selected.length === 0 ? null : selected, { |
| 229 | updated_view: this, |
| 230 | }); |
| 231 | this.touch(); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | reset_zoom(that) { |
| 236 | that.zoom.transform(that.parent.bg, d3.zoomIdentity); |
nothing calls this directly
no test coverage detected