Author: jbeard
Date: Wed Jun 30 13:24:34 2010
New Revision: 959299

URL: http://svn.apache.org/viewvc?rev=959299&view=rev
Log:
Diagnosed and fixed strange dragging behaviour that was occuring in demos in 
Firefox. Related to https://bugzilla.mozilla.org/show_bug.cgi?id=525591 and 
applied js-only fix from #c4.

Modified:
    
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop.xhtml
    
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xhtml
    
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop3.svg

Modified: 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop.xhtml
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop.xhtml?rev=959299&r1=959298&r2=959299&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop.xhtml
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop.xhtml
 Wed Jun 30 13:24:34 2010
@@ -168,7 +168,7 @@ using SCXML: 
 
                                                        //hook up DOM events
                                                        
["mousedown","mouseup","mousemove"].forEach(function(eventName){
-                                                               
domNodeToHookUp.addEventListener(eventName,compiledStatechartInstance[eventName],false);
+                                                               
domNodeToHookUp.addEventListener(eventName,function(e){e.preventDefault();compiledStatechartInstance[eventName](e)},false);
                                                        });
                                                });
                                        }

Modified: 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xhtml
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xhtml?rev=959299&r1=959298&r2=959299&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xhtml
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xhtml
 Wed Jun 30 13:24:34 2010
@@ -124,7 +124,7 @@ own state.
 
                                                //hook up DOM events
                                                
["mousedown","mouseup","mousemove"].forEach(function(eventName){
-                                                       
newGNode.addEventListener(eventName,compiledStatechartInstance[eventName],false);
+                                                       
newGNode.addEventListener(eventName,function(e){e.preventDefault();compiledStatechartInstance[eventName](e)},false);
                                                });
 
                                                svgCanvas.appendChild(newGNode);

Modified: 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop3.svg
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop3.svg?rev=959299&r1=959298&r2=959299&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop3.svg
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop3.svg
 Wed Jun 30 13:24:34 2010
@@ -60,11 +60,14 @@ using SCXML: 
 
                //hook up DOM events
                ["mousedown","mouseup","mousemove"].forEach(function(eventName){
-                       
groupToTranslate.addEventListener(eventName,compiledStatechartInstance[eventName],false);
+                       //we call e.preventDefault for all of these events to 
prevent firefox from using its default dragging behaviour: 
+                       //see 
https://bugzilla.mozilla.org/show_bug.cgi?id=525591#c4
+                       //it may be the case that only certain events (md, mu, 
or mm) need to be canceled to prevent this behaviour
+                       
groupToTranslate.addEventListener(eventName,function(e){e.preventDefault();compiledStatechartInstance[eventName](e)},false);
                });
 
                //quick hack to ensure that mm events get captured by the rect
-               
svgRoot.addEventListener("mousemove",compiledStatechartInstance["mousemove"],false);
+               
svgRoot.addEventListener("mousemove",function(e){e.preventDefault();compiledStatechartInstance["mousemove"](e);},false);
 
 
        ]]></script>


Reply via email to