-
Notifications
You must be signed in to change notification settings - Fork 0
/
combo.js
30 lines (26 loc) · 908 Bytes
/
combo.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
class ComboFractal extends Mandelbrot {
constructor() {
super();
document.getElementById('julia-map').innerHTML = '<canvas id="julia-canvas" />';
this.julia = new Julia('julia-canvas');
}
setOptionsAndDraw(options, opt_mouseX, opt_mouseY) {
super.setOptionsAndDraw(options);
if (options['center']) {
options['center'] = [
this.variables['offsetX'].value + (opt_mouseX / this.canvas.width * 2 - 1) * this.variables['zoom'].value - 1.0,
this.variables['offsetY'].value + (1 - opt_mouseY / this.canvas.height * 2) * this.variables['zoom'].value
];
}
options['offsetX'] = 0;
options['offsetY'] = 0;
if (options['zoom']) {
options['zoom'] *= 100;
options['zoom'] = Math.min(1.5, options['zoom']);
}
this.julia.setOptionsAndDraw(options);
}
dispose() {
document.getElementById('julia-map').innerHTML = '';
}
}