declare compat with Gecko 12 versions
authorRobert Kaiser <kairo@kairo.at>
Thu, 22 Dec 2011 18:21:06 +0000 (19:21 +0100)
committerRobert Kaiser <kairo@kairo.at>
Thu, 22 Dec 2011 18:21:06 +0000 (19:21 +0100)
Makefile.in
content/mandelbrot.js
install.rdf

index a44d02ec0300f444065c00f6051fc850aeb7067f..2e0331e0dc806f96c56be9fe628a026dc416cab3 100644 (file)
@@ -49,7 +49,7 @@ endif
 
 MODULE                 = mandelbrot
 
-EXTENSION_VERSION      = 4.0
+EXTENSION_VERSION      = 4.0.1
 
 XPI_NAME               = mandelbrot
 USE_EXTENSION_MANIFEST = 1
index 7d77b1236609b83625fdb1d407e1f46cf884d988..279d3ae26f2a656438ab4b561f85bb3310f9d128 100644 (file)
@@ -467,27 +467,45 @@ function drawPoint(context, img_x, img_y, C, iterMax, algorithm) {
 
 var zoomstart;
 var imgBackup;
+var zoomTouchID;
 
 let imgEvHandler = {
   handleEvent: function(aEvent) {
     let canvas = document.getElementById("mbrotImage");
     let context = canvas.getContext("2d");
+    let touchEvent = aEvent.type.indexOf('touch') != -1;
+
+    // Bail out if this is neither a touch nor left-click.
+    if (!touchEvent && aEvent.button != 0)
+      return;
+
+    // Bail out if the started touch can't be found.
+    if (touchEvent && zoomstart &&
+        !aEvent.changedTouches.identifiedTouch(zoomTouchID))
+      return;
+
+    let coordObj = touchEvent ?
+                   aEvent.changedTouches.identifiedTouch(zoomTouchID) :
+                   aEvent;
+
     switch (aEvent.type) {
       case 'mousedown':
       case 'touchstart':
-        if (aEvent.button == 0) {
-          // left button - start dragzoom
-          zoomstart = {x: aEvent.clientX - canvas.offsetLeft,
-                       y: aEvent.clientY - canvas.offsetTop};
-          imgBackup = context.getImageData(0, 0, canvas.width, canvas.height);
+        if (touchEvent) {
+          zoomTouchID = aEvent.changedTouches.item(0).identifier;
+          coordObj = aEvent.changedTouches.identifiedTouch(zoomTouchID);
         }
+        // left button - start dragzoom
+        zoomstart = {x: coordObj.clientX - canvas.offsetLeft,
+                     y: coordObj.clientY - canvas.offsetTop};
+        imgBackup = context.getImageData(0, 0, canvas.width, canvas.height);
         break;
       case 'mouseup':
       case 'touchend':
-        if (aEvent.button == 0 && zoomstart) {
+        if (zoomstart) {
           context.putImageData(imgBackup, 0, 0);
-          let zoomend = {x: aEvent.clientX - canvas.offsetLeft,
-                        y: aEvent.clientY - canvas.offsetTop};
+          let zoomend = {x: coordObj.clientX - canvas.offsetLeft,
+                         y: coordObj.clientY - canvas.offsetTop};
 
           // make sure zoomend is bigger than zoomstart
           if ((zoomend.x == zoomstart.x) || (zoomend.y == zoomstart.y)) {
@@ -516,12 +534,12 @@ let imgEvHandler = {
         break;
       case 'mousemove':
       case 'touchmove':
-        if (aEvent.button == 0 && zoomstart) {
+        if (zoomstart) {
           context.putImageData(imgBackup, 0, 0);
           context.strokeStyle = "rgb(255,255,31)";
           context.strokeRect(zoomstart.x, zoomstart.y,
-                             aEvent.clientX - canvas.offsetLeft - zoomstart.x,
-                             aEvent.clientY - canvas.offsetTop - zoomstart.y);
+                             coordObj.clientX - canvas.offsetLeft - zoomstart.x,
+                             coordObj.clientY - canvas.offsetTop - zoomstart.y);
         }
       break;
     }
@@ -588,7 +606,7 @@ function updateBookmarkMenu(aParent) {
   na.setAttribute("disabled", "true");
 }
 
-function goBack () {
+function goBack() {
   if (gLastImageData) {
     Services.prefs.setIntPref("mandelbrot.iteration_max",
                               gLastImageData.iterMax);
index fe5345cbd2f2bf4cc1343d1aa9796d94310bb95e..5928584644d7847cc3a7fbfab784bc26da39247f 100644 (file)
@@ -14,7 +14,7 @@
       <Description>
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
         <em:minVersion>4.0</em:minVersion>
-        <em:maxVersion>11.0a1</em:maxVersion>
+        <em:maxVersion>12.0a1</em:maxVersion>
       </Description>
     </em:targetApplication>
     <!-- SeaMonkey -->
@@ -22,7 +22,7 @@
       <Description>
         <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
         <em:minVersion>2.1</em:minVersion>
-        <em:maxVersion>2.8a1</em:maxVersion>
+        <em:maxVersion>2.9a1</em:maxVersion>
       </Description>
     </em:targetApplication>
     <!-- Fennec -->
@@ -30,7 +30,7 @@
       <Description>
         <em:id>{a23983c0-fd0e-11dc-95ff-0800200c9a66}</em:id>
         <em:minVersion>4.0</em:minVersion>
-        <em:maxVersion>11.0a1</em:maxVersion>
+        <em:maxVersion>12.0a1</em:maxVersion>
       </Description>
     </em:targetApplication>
     <!-- toolkit -->
@@ -38,7 +38,7 @@
       <Description>
         <em:id>toolkit@mozilla.org</em:id>
         <em:minVersion>2.0</em:minVersion>
-        <em:maxVersion>11.0</em:maxVersion>
+        <em:maxVersion>12.0</em:maxVersion>
       </Description>
     </em:targetApplication>
   </Description>