(animate?)
| 153 | } |
| 154 | |
| 155 | draw(animate?) { |
| 156 | this.set_ranges(); |
| 157 | |
| 158 | const x_scale = this.scales.x ? this.scales.x : this.parent.scale_x; |
| 159 | const y_scale = this.scales.y ? this.scales.y : this.parent.scale_y; |
| 160 | |
| 161 | const animation_duration = animate |
| 162 | ? this.parent.model.get('animation_duration') |
| 163 | : 0; |
| 164 | const el = (this.d3el || this.el) as d3.Selection<any, any, any, any>; |
| 165 | const x_scaled = this.model.mark_data['x'].map(x_scale.scale), |
| 166 | y_scaled = this.model.mark_data['y'].map(y_scale.scale); |
| 167 | |
| 168 | el.selectAll('image') |
| 169 | .transition() |
| 170 | .duration(animation_duration) |
| 171 | .attr('transform', (d) => { |
| 172 | const tx = x_scaled[0] + x_scale.offset; |
| 173 | const ty = y_scaled[1] + y_scale.offset; |
| 174 | const sx = x_scaled[1] - x_scaled[0]; |
| 175 | const sy = y_scaled[0] - y_scaled[1]; |
| 176 | return 'translate(' + tx + ',' + ty + ') scale(' + sx + ', ' + sy + ')'; |
| 177 | }); |
| 178 | el.on( |
| 179 | 'click', |
| 180 | _.bind(function (d, i) { |
| 181 | this.img_send_message('element_clicked', { data: d3.event, index: i }); |
| 182 | }, this) |
| 183 | ); |
| 184 | } |
| 185 | |
| 186 | clear_style(style_dict, indices?, elements?) {} |
| 187 |
no test coverage detected