From 7727ce46183a6fb4adaaf0e5b63cd06a6034a2a8 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Wed, 29 Oct 2008 18:52:25 +0100 Subject: [PATCH 1/1] add scale field in image settings, add extra button for drawing image right away# --- .../mandelbrot/content/image-settings.js | 15 +++++++++++ .../mandelbrot/content/image-settings.xul | 26 +++++++++++++------ .../chrome/mandelbrot/content/mandelbrot.js | 2 +- .../locales/en-US/image-settings.dtd | 1 + 4 files changed, 35 insertions(+), 9 deletions(-) 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;">