X-Git-Url: https://git-public.kairo.at/?p=mandelbrot.git;a=blobdiff_plain;f=xulapp%2Fchrome%2Fmandelbrot%2Fcontent%2Fimage-settings.js;h=a907f5a20bf677a820a4350f3c40b43f88d18a2d;hp=d9af9935a85f0c138dac817bce1d080206a462c4;hb=7727ce46183a6fb4adaaf0e5b63cd06a6034a2a8;hpb=eceff1c913ed3ce42776db2b5b1cf69e44f0b921 diff --git a/xulapp/chrome/mandelbrot/content/image-settings.js b/xulapp/chrome/mandelbrot/content/image-settings.js index d9af993..a907f5a 100644 --- a/xulapp/chrome/mandelbrot/content/image-settings.js +++ b/xulapp/chrome/mandelbrot/content/image-settings.js @@ -38,6 +38,8 @@ var gColorPalette = []; function initSettings() { + recalcCoord('Cr', 'scale'); + recalcCoord('Ci', 'scale'); } function drawPreview() { @@ -78,3 +80,16 @@ function drawPreview() { drawLine(0, [Cr_min, Cr_max, Ci_min, Ci_max], canvas, context, iterMax, algorithm); } + +function recalcCoord(coord, target) { + if (target == 'scale') { + document.getElementById(coord + '_scale').value = + parseFloat(document.getElementById(coord + '_max').value) - + parseFloat(document.getElementById(coord + '_min').value); + } + else if (target == 'max') { + document.getElementById('mandelbrot.last_image.' + coord + '_max').value = + parseFloat(document.getElementById(coord + '_min').value) + + parseFloat(document.getElementById(coord + '_scale').value); + } +} \ No newline at end of file