From: Robert Kaiser Date: Wed, 29 Oct 2008 17:52:25 +0000 (+0100) Subject: add scale field in image settings, add extra button for drawing image right away# X-Git-Url: https://git-public.kairo.at/?a=commitdiff_plain;h=7727ce46183a6fb4adaaf0e5b63cd06a6034a2a8;p=mandelbrot.git add scale field in image settings, add extra button for drawing image right away# --- 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 diff --git a/xulapp/chrome/mandelbrot/content/image-settings.xul b/xulapp/chrome/mandelbrot/content/image-settings.xul index 04da656..c4c6092 100644 --- a/xulapp/chrome/mandelbrot/content/image-settings.xul +++ b/xulapp/chrome/mandelbrot/content/image-settings.xul @@ -46,9 +46,9 @@ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" title="&imageSettings.title;" - dlgbuttons="accept,cancel" - ondialogaccept="callDrawImage();" - buttonlabelaccept="&DrawImageButton.label;"> + buttons="accept,cancel,extra1" + ondialogextra1="callDrawImage();" + buttonlabelextra1="&DrawImageButton.label;">