commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r985576 - in /commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool: drawing-tool-precompiled.html drawing-tool.html
Date Sat, 14 Aug 2010 20:01:29 GMT
Author: jbeard
Date: Sat Aug 14 20:01:29 2010
New Revision: 985576

URL: http://svn.apache.org/viewvc?rev=985576&view=rev
Log:
Fixed spacing in drawing-tool-precompiled (used tabs instead of two space indentation), and
fixed JIT-compiled version.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/drawing-tool-precompiled.html
    commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/drawing-tool.html

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/drawing-tool-precompiled.html
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/drawing-tool-precompiled.html?rev=985576&r1=985575&r2=985576&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/drawing-tool-precompiled.html
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/drawing-tool-precompiled.html
Sat Aug 14 20:01:29 2010
@@ -59,149 +59,148 @@
     <script src="build/canvas.js"></script>
 
     <script>
-      $(document).ready(function(){
+$(document).ready(function(){
 
-        //hook up minimal console api
-        if(typeof console == "undefined"){
-          console = {};
-          ["log","info","error","dirxml"].forEach(function(m){console[m] = console[m] ||
function(){} });
-        } 
-
-
-        var scxmlns = "http://www.w3.org/2005/07/scxml";
-        var svgns = "http://www.w3.org/2000/svg";
-
-        $("#toolbarDiv").svg({
-          onLoad:function(toolbar){
-            $(toolbar.root()).attr({
-              "width":"150px",
-              "height":"50px"
-            });
-
-            $(document.body).svg({
-              onLoad:function(svg){
-
-                $(svg.root()).attr({
-                  "width":"100%",
-                  "height":"100%"
-                });
-
-                var toolbarOutlineRect = toolbar.rect(0,0,150,50,{
-                  fill:"white", 
-                  stroke:"black"
-                }) ;
-
-                var transformButton = toolbar.group();
-
-                var transformButtonBackground = toolbar.rect(transformButton,0,0,50,50,{
-                  class:"background"
-                });
-
-								//TODO: make proper icon
-                var transformButtonIcon = toolbar.circle(transformButton,25,25,15,{
-                  fill:"green",
-                  stroke:"black"
-                });
-                
-                var rectButton = toolbar.group({"transform":"translate(50,0)"});
-                var rectButtonBackground = toolbar.rect(rectButton,0,0,50,50,{ 
-                  class:"background"
-                });
-                var rectButtonIcon = toolbar.rect(rectButton,10,10,30,30,{ 
-                  fill:"red", 
-                  stroke:"black"
-                });
-
-                var ellipseButton = toolbar.group({"transform":"translate(100,0)"});
-
-                var ellipseButtonBackground = toolbar.rect(ellipseButton,0,0,50,50,{
-                  class:"background"
-                });
-
-                var ellipseButtonIcon = toolbar.circle(ellipseButton,25,25,15,{
-                  fill:"blue",
-                  stroke:"black"
-                });
-
-								//workaround for webkit: svg root element does not receive events on its own, 
-								//so we create a white background rect, and proxy events to svg element
-								if($.browser.webkit){
-									 var backgroundRect = svg.rect(0,0,"100%","100%",{
-										stroke:"none",
-										fill:"white"
-									}) 
-									console.log(backgroundRect);
-
-									$(["mousedown","mouseup","mousemove"]).each(function(index,eventName){
-										backgroundRect.addEventListener(eventName,function(e){
-											svg.root().dispatchEvent(e);
-										},false)
-									});
-								}
-
-								var scaleHandle = svg.path("M 0 0 L -4 6 L -2 6 L -2 12 L -4 12 L 0 18 L 4 12 L 2
12 L 2 6 L 4 6 L 0 0 z",{
-									transform:"rotate(-45)",
-									visibility:"hidden"
-								})
-
-								var rotationHandle =  svg.path("M 12 0 L 17 5 L 15 5 Q 15 15 5 15 L 5 17 L 0 12 L
5 7 L 5 9 Q 9 9 9 5 L 7 5 L 12 0 z",{
-									visibility:"hidden",
-									transform:"translate(0,0)"
-								})
-
-
-                function hookUpDOMEvents(node,compiledStatechartInstance){
-                  //hook up DOM events
-                  ["mousedown","mouseup","mousemove"].forEach(function(eventName){
-                    if(compiledStatechartInstance[eventName]){
-                      node.addEventListener(eventName,function(e){
-                        e.preventDefault();
-                        compiledStatechartInstance[eventName](e)
-                      },false);
-                    }
-                  });
-                }
-
-                require(
-                  {
-                    "baseUrl":"/"
-                  },
-                  [ "demo/drawing-tool/transform"],
-
-                  function(svgTransformModule){
-
-										//hook up canvas behaviour
-										canvasSC = new CanvasStatechartExecutionContext(); 
-
-										svg.statechart = canvasSC;	//hook up dom node reference
-
-										canvasSC.initialize();
-
-										//pass in reference to rect
-										canvasSC.init({  
-											svg:svg,
-											transformModule:svgTransformModule,
-											scaleHandle:scaleHandle,
-											rotationHandle:rotationHandle,
-											ellipseButton:ellipseButton,
-											rectButton:rectButton,
-											transformButton:transformButton,
-											ellipseIcon:ellipseButtonIcon,
-											rectIcon:rectButtonIcon,
-											transformIcon:transformButtonIcon 
-										});   
-
-										hookUpDOMEvents(svg.root(),canvasSC);
-										hookUpDOMEvents(toolbar.root(),canvasSC);
-
-								});
-              }  
-            })
-          }
-        });
+	//hook up minimal console api
+	if(typeof console == "undefined"){
+		console = {};
+		["log","info","error","dirxml"].forEach(function(m){console[m] = console[m] || function(){}
});
+	} 
+
+	var scxmlns = "http://www.w3.org/2005/07/scxml";
+	var svgns = "http://www.w3.org/2000/svg";
+
+	$("#toolbarDiv").svg({
+		onLoad:function(toolbar){
+			$(toolbar.root()).attr({
+				"width":"150px",
+				"height":"50px"
+			});
+
+			$(document.body).svg({
+				onLoad:function(svg){
+
+					$(svg.root()).attr({
+						"width":"100%",
+						"height":"100%"
+					});
+
+					var toolbarOutlineRect = toolbar.rect(0,0,150,50,{
+						fill:"white", 
+						stroke:"black"
+					}) ;
+
+					var transformButton = toolbar.group();
+
+					var transformButtonBackground = toolbar.rect(transformButton,0,0,50,50,{
+						class:"background"
+					});
+
+					//TODO: make proper icon
+					var transformButtonIcon = toolbar.circle(transformButton,25,25,15,{
+						fill:"green",
+						stroke:"black"
+					});
+					
+					var rectButton = toolbar.group({"transform":"translate(50,0)"});
+					var rectButtonBackground = toolbar.rect(rectButton,0,0,50,50,{ 
+						class:"background"
+					});
+					var rectButtonIcon = toolbar.rect(rectButton,10,10,30,30,{ 
+						fill:"red", 
+						stroke:"black"
+					});
+
+					var ellipseButton = toolbar.group({"transform":"translate(100,0)"});
+
+					var ellipseButtonBackground = toolbar.rect(ellipseButton,0,0,50,50,{
+						class:"background"
+					});
+
+					var ellipseButtonIcon = toolbar.circle(ellipseButton,25,25,15,{
+						fill:"blue",
+						stroke:"black"
+					});
+
+					//workaround for webkit: svg root element does not receive events on its own, 
+					//so we create a white background rect, and proxy events to svg element
+					if($.browser.webkit){
+						 var backgroundRect = svg.rect(0,0,"100%","100%",{
+							stroke:"none",
+							fill:"white"
+						}) 
+						console.log(backgroundRect);
+
+						$(["mousedown","mouseup","mousemove"]).each(function(index,eventName){
+							backgroundRect.addEventListener(eventName,function(e){
+								svg.root().dispatchEvent(e);
+							},false)
+						});
+					}
+
+					var scaleHandle = svg.path("M 0 0 L -4 6 L -2 6 L -2 12 L -4 12 L 0 18 L 4 12 L 2 12
L 2 6 L 4 6 L 0 0 z",{
+						transform:"rotate(-45)",
+						visibility:"hidden"
+					})
+
+					var rotationHandle = svg.path("M 12 0 L 17 5 L 15 5 Q 15 15 5 15 L 5 17 L 0 12 L 5 7
L 5 9 Q 9 9 9 5 L 7 5 L 12 0 z",{
+						visibility:"hidden",
+						transform:"translate(0,0)"
+					})
+
+
+					function hookUpDOMEvents(node,compiledStatechartInstance){
+						//hook up DOM events
+						["mousedown","mouseup","mousemove"].forEach(function(eventName){
+							if(compiledStatechartInstance[eventName]){
+								node.addEventListener(eventName,function(e){
+									e.preventDefault();
+									compiledStatechartInstance[eventName](e)
+								},false);
+							}
+						});
+					}
+
+					require(
+						{
+							"baseUrl":"/"
+						},
+						[ "demo/drawing-tool/transform"],
+
+						function(svgTransformModule){
+
+							//hook up canvas behaviour
+							canvasSC = new CanvasStatechartExecutionContext(); 
+
+							svg.statechart = canvasSC;	//hook up dom node reference
+
+							canvasSC.initialize();
+
+							//pass in reference to rect
+							canvasSC.init({	
+								svg:svg,
+								transformModule:svgTransformModule,
+								scaleHandle:scaleHandle,
+								rotationHandle:rotationHandle,
+								ellipseButton:ellipseButton,
+								rectButton:rectButton,
+								transformButton:transformButton,
+								ellipseIcon:ellipseButtonIcon,
+								rectIcon:rectButtonIcon,
+								transformIcon:transformButtonIcon 
+							});	 
+
+							hookUpDOMEvents(svg.root(),canvasSC);
+							hookUpDOMEvents(toolbar.root(),canvasSC);
+
+						}
+					);
+				}	
+			})
+		}
+	});
 
-        //build up the DOM
-      });
+});
     </script>
   </head>
   <body>

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/drawing-tool.html
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/drawing-tool.html?rev=985576&r1=985575&r2=985576&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/drawing-tool.html (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/drawing-tool.html Sat Aug 14
20:01:29 2010
@@ -42,8 +42,8 @@
         stroke : none;
       }
 
-      circle.selected, rect.selected {
-        stroke-dasharray : 4 4;
+      ellipse.selected, rect.selected {
+        stroke-dasharray : 5,5;
       }
 
       @import "lib/jquery.svg.css";
@@ -58,6 +58,181 @@
     <script src="lib/jquery.svgdom.js" type="text/javascript"></script>
 
     <script>
+$(document).ready(function(){
+
+	//hook up minimal console api
+	if(typeof console == "undefined"){
+		console = {};
+		["log","info","error","dirxml"].forEach(function(m){console[m] = console[m] || function(){}
});
+	} 
+
+	var scxmlns = "http://www.w3.org/2005/07/scxml";
+	var svgns = "http://www.w3.org/2000/svg";
+
+	$("#toolbarDiv").svg({
+		onLoad:function(toolbar){
+			$(toolbar.root()).attr({
+				"width":"150px",
+				"height":"50px"
+			});
+
+			$(document.body).svg({
+				onLoad:function(svg){
+
+					$(svg.root()).attr({
+						"width":"100%",
+						"height":"100%"
+					});
+
+					var toolbarOutlineRect = toolbar.rect(0,0,150,50,{
+						fill:"white", 
+						stroke:"black"
+					}) ;
+
+					var transformButton = toolbar.group();
+
+					var transformButtonBackground = toolbar.rect(transformButton,0,0,50,50,{
+						class:"background"
+					});
+
+					//TODO: make proper icon
+					var transformButtonIcon = toolbar.circle(transformButton,25,25,15,{
+						fill:"green",
+						stroke:"black"
+					});
+					
+					var rectButton = toolbar.group({"transform":"translate(50,0)"});
+					var rectButtonBackground = toolbar.rect(rectButton,0,0,50,50,{ 
+						class:"background"
+					});
+					var rectButtonIcon = toolbar.rect(rectButton,10,10,30,30,{ 
+						fill:"red", 
+						stroke:"black"
+					});
+
+					var ellipseButton = toolbar.group({"transform":"translate(100,0)"});
+
+					var ellipseButtonBackground = toolbar.rect(ellipseButton,0,0,50,50,{
+						class:"background"
+					});
+
+					var ellipseButtonIcon = toolbar.circle(ellipseButton,25,25,15,{
+						fill:"blue",
+						stroke:"black"
+					});
+
+					//workaround for webkit: svg root element does not receive events on its own, 
+					//so we create a white background rect, and proxy events to svg element
+					if($.browser.webkit){
+						 var backgroundRect = svg.rect(0,0,"100%","100%",{
+							stroke:"none",
+							fill:"white"
+						}) 
+						console.log(backgroundRect);
+
+						$(["mousedown","mouseup","mousemove"]).each(function(index,eventName){
+							backgroundRect.addEventListener(eventName,function(e){
+								svg.root().dispatchEvent(e);
+							},false)
+						});
+					}
+
+					var scaleHandle = svg.path("M 0 0 L -4 6 L -2 6 L -2 12 L -4 12 L 0 18 L 4 12 L 2 12
L 2 6 L 4 6 L 0 0 z",{
+						transform:"rotate(-45)",
+						visibility:"hidden"
+					})
+
+					var rotationHandle = svg.path("M 12 0 L 17 5 L 15 5 Q 15 15 5 15 L 5 17 L 0 12 L 5 7
L 5 9 Q 9 9 9 5 L 7 5 L 12 0 z",{
+						visibility:"hidden",
+						transform:"translate(0,0)"
+					})
+
+
+					function hookUpDOMEvents(node,compiledStatechartInstance){
+						//hook up DOM events
+						["mousedown","mouseup","mousemove"].forEach(function(eventName){
+							if(compiledStatechartInstance[eventName]){
+								node.addEventListener(eventName,function(e){
+									e.preventDefault();
+									compiledStatechartInstance[eventName](e)
+								},false);
+							}
+						});
+					}
+
+					require(
+						{
+							"baseUrl":"/"
+						},
+						["src/javascript/scxml/cgf/SCXMLCompiler",
+							"demo/drawing-tool/transform",
+							"xml!demo/drawing-tool/behaviour/canvas.xml" ],
+
+						function(compiler,svgTransformModule,canvasBehaviourSCXML){
+
+							require( [window.DOMParser ?
+								"src/javascript/scxml/cgf/util/xsl/browser" :
+								"src/javascript/scxml/cgf/util/xsl/ie"],
+								function(xslTransformer){
+
+							
+									var d = new Date();
+
+									compiler.compile({
+										inFiles:[canvasBehaviourSCXML],
+										//debug:true,
+										backend:"state",
+										beautify:true,
+										verbose:false,
+										log:false,
+										ie:false
+									}, function(scArr){
+							
+										console.log("Compiling statecharts took:",new Date() - d);
+
+										//eval
+										for(var i=0, l=scArr.length; i < l; i++){
+											console.log(scArr[i]);
+											eval(scArr[i]);
+										}
+
+										//hook up canvas behaviour
+										canvasSC = new CanvasStatechartExecutionContext(); 
+
+										svg.statechart = canvasSC;	//hook up dom node reference
+
+										canvasSC.initialize();
+
+										//pass in reference to rect
+										canvasSC.init({	
+											svg:svg,
+											transformModule:svgTransformModule,
+											scaleHandle:scaleHandle,
+											rotationHandle:rotationHandle,
+											ellipseButton:ellipseButton,
+											rectButton:rectButton,
+											transformButton:transformButton,
+											ellipseIcon:ellipseButtonIcon,
+											rectIcon:rectButtonIcon,
+											transformIcon:transformButtonIcon 
+										});	 
+
+										hookUpDOMEvents(svg.root(),canvasSC);
+										hookUpDOMEvents(toolbar.root(),canvasSC);
+
+									},xslTransformer);
+							})
+						}
+					);
+				}	
+			})
+		}
+	});
+
+});
+
+
+
       $(document).ready(function(){
 
         //hook up minimal console api
@@ -140,68 +315,6 @@
                   });
                 }
 
-                require(
-                  {
-                    "baseUrl":"/"
-                  },
-                  ["src/javascript/scxml/cgf/SCXMLCompiler",
-                    "demo/drawing-tool/transform",
-                    "xml!demo/drawing-tool/behaviour/canvas.xml" ],
-
-                  function(compiler,svgTransformer,canvasBehaviourSCXML){
-
-                    require( [window.DOMParser ?
-                        "src/javascript/scxml/cgf/util/xsl/browser" :
-                        "src/javascript/scxml/cgf/util/xsl/ie"],
-                      function(xslTransformer){
-
-              
-                      var d = new Date();
-
-                      compiler.compile({
-                        inFiles:[canvasBehaviourSCXML],
-                        //debug:true,
-                        backend:"state",
-                        beautify:true,
-                        verbose:false,
-                        log:false,
-                        ie:false
-                      }, function(scArr){
-            
-                        console.log("Compiling statecharts took:",new Date() - d);
-                        //eval
-                        for(var i=0, l=scArr.length; i < l; i++){
-                          console.log(scArr[i]);
-                          eval(scArr[i]);
-                        }
-
-                        //hook up canvas behaviour
-                        var canvasSC = new CanvasStatechartExecutionContext(); 
-
-			svg.statechart = canvasSC;	//hook up dom node reference
-
-                        canvasSC.initialize();
-                        
-                        //pass in reference to rect
-                        canvasSC.init({  
-                          svg:svg,
-			  scaleHandle:scaleHandle,
-			  rotationHandle:rotationHandle,
-                          ellipseButton:ellipseButton,
-                          rectButton:rectButton,
-                          transformButton:transformButton,
-                          ellipseIcon:ellipseButtonIcon,
-                          rectIcon:rectButtonIcon,
-                          transformIcon:transformButtonIcon 
-                        });   
-
-                        hookUpDOMEvents(svg.root(),canvasSC);
-                        hookUpDOMEvents(toolbar.root(),canvasSC);
-
-                      },xslTransformer);
-                    })
-                  }
-                );
               }  
             })
           }



Mime
View raw message