+
+function recalcCoord(coord, target) {
+ let othercoord = (coord == 'Ci') ? 'Cr' : 'Ci';
+ let owndim = (coord == 'Ci') ? 'height' : 'width';
+ let otherdim = (coord == 'Ci') ? 'width' : 'height';
+ if (target == 'scale') {
+ var myscale =
+ parseFloat(document.getElementById(coord + '_max').value) -
+ parseFloat(document.getElementById(coord + '_min').value);
+ document.getElementById(coord + '_scale').value = roundCoord(myscale);
+ }
+ else if (target == 'max') {
+ let mymax =
+ parseFloat(document.getElementById(coord + '_min').value) +
+ parseFloat(document.getElementById(coord + '_scale').value);
+ document.getElementById('mandelbrot.last_image.' + coord + '_max').value = roundCoord(mymax);
+ var myscale = document.getElementById(coord + '_scale').value;
+ }
+ if (document.getElementById('syncProp').checked) {
+ let otherscale = myscale *
+ document.getElementById('mandelbrot.image.' + otherdim).value /
+ document.getElementById('mandelbrot.image.' + owndim).value;
+ document.getElementById(othercoord + '_scale').value = roundCoord(otherscale);
+ let othermax =
+ parseFloat(document.getElementById(othercoord + '_min').value) +
+ parseFloat(document.getElementById(othercoord + '_scale').value);
+ document.getElementById('mandelbrot.last_image.' + othercoord + '_max').value = roundCoord(othermax);
+ }
+}
+
+function checkProportions() {
+ if (!document.getElementById('syncProp').checked) {
+ recalcCoord('Cr', 'scale');
+ }
+}
+
+function roundCoord(floatval) {
+ // We should round to 10 decimals here or so
+ return floatval;
+}
+
+function callDrawImage() {
+ window.opener.drawImage();
+ window.close();
+}
\ No newline at end of file