forked from algorithm-visualizer/algorithm-visualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArray1DTracer.js
46 lines (36 loc) · 813 Bytes
/
Array1DTracer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { Array2DTracer } from 'core/tracers';
import { Array1DRenderer } from 'core/renderers';
class Array1DTracer extends Array2DTracer {
getRendererClass() {
return Array1DRenderer;
}
init() {
super.init();
this.chartTracer = null;
}
set(array1d = []) {
const array2d = [array1d];
super.set(array2d);
this.syncChartTracer();
}
patch(x, v) {
super.patch(0, x, v);
}
depatch(x) {
super.depatch(0, x);
}
select(sx, ex = sx) {
super.select(0, sx, 0, ex);
}
deselect(sx, ex = sx) {
super.deselect(0, sx, 0, ex);
}
chart(key) {
this.chartTracer = key ? this.getObject(key) : null;
this.syncChartTracer();
}
syncChartTracer() {
if (this.chartTracer) this.chartTracer.data = this.data;
}
}
export default Array1DTracer;