From: Robert Kaiser Date: Tue, 28 Jul 2009 19:11:46 +0000 (+0200) Subject: start functionality for zooming, right now just alert with coordinates we dragged... X-Git-Url: https://git-public.kairo.at/?a=commitdiff_plain;h=4d8e7dcbb2fdcb51faf6e0c2f3ba4c24c8b9e7b3;p=mandelbrot.git start functionality for zooming, right now just alert with coordinates we dragged over --- diff --git a/xulapp/chrome/mandelbrot/content/mandelbrot.js b/xulapp/chrome/mandelbrot/content/mandelbrot.js index bcc2df5..7a67687 100644 --- a/xulapp/chrome/mandelbrot/content/mandelbrot.js +++ b/xulapp/chrome/mandelbrot/content/mandelbrot.js @@ -335,6 +335,27 @@ function drawPoint(context, img_x, img_y, C, iterMax, algorithm) { /***** pure UI functions *****/ +var zoomstart; + +function mouseevent(etype, event) { + let canvas = document.getElementById("mbrotImage"); + switch (etype) { + case 'down': + if (event.button == 0) + // left button - start dragzoom + zoomstart = {x: event.clientX - canvas.offsetLeft, + y: event.clientY - canvas.offsetTop}; + break; + case 'up': + if (event.button == 0) + alert(zoomstart.x + ',' + zoomstart.y + '-' + + (event.clientX - canvas.offsetLeft) + ',' + + (event.clientY - canvas.offsetTop)); + zoomstart = undefined; + break; + } +} + function saveImage() { const bundle = document.getElementById("mbrotBundle"); const nsIFilePicker = Components.interfaces.nsIFilePicker; diff --git a/xulapp/chrome/mandelbrot/content/mandelbrot.xul b/xulapp/chrome/mandelbrot/content/mandelbrot.xul index c6cd044..183c6ca 100644 --- a/xulapp/chrome/mandelbrot/content/mandelbrot.xul +++ b/xulapp/chrome/mandelbrot/content/mandelbrot.xul @@ -108,7 +108,10 @@ - + +