commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r984044 - in /commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool: behaviour/canvas.xml drawing-tool-precompiled.html
Date Tue, 10 Aug 2010 14:21:34 GMT
Author: jbeard
Date: Tue Aug 10 14:21:34 2010
New Revision: 984044

URL: http://svn.apache.org/viewvc?rev=984044&view=rev
Log:
jquery svg's addClass was causing erratic behaviour in Opera and Chromium, so swapped it out
for less scalable, but more reliable DOM manipulation

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

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/behaviour/canvas.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/behaviour/canvas.xml?rev=984044&r1=984043&r2=984044&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/behaviour/canvas.xml (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/demo/drawing-tool/behaviour/canvas.xml Tue Aug
10 14:21:34 2010
@@ -235,12 +235,14 @@ In both:
 			<state id="transform_tool_selected">
 				<onentry>
 					<script>
-						$(transformButton).addClass("selected");
+						//$(transformButton).addClass("selected");
+						transformButton.setAttributeNS(null,"class","selected");
 					</script>
 				</onentry>
 				<onexit>
 					<script>
-						$(transformButton).removeClass("selected");
+						//$(transformButton).removeClass("selected");
+						transformButton.removeAttributeNS(null,"class");
 					</script>
 				</onexit>
 
@@ -309,12 +311,14 @@ In both:
 				<state id="ellipse_tool_selected">
 					<onentry>
 						<script>
-							$(ellipseButton).addClass("selected");
+							//$(ellipseButton).addClass("selected");
+							ellipseButton.setAttributeNS(null,"class","selected");
 						</script>
 					</onentry>
 					<onexit>
 						<script>
-							$(ellipseButton).removeClass("selected");
+							//$(ellipseButton).removeClass("selected");
+							ellipseButton.removeAttributeNS(null,"class");
 						</script>
 					</onexit>
 
@@ -324,12 +328,14 @@ In both:
 				<state id="rect_tool_selected">
 					<onentry>
 						<script>
-							$(rectButton).addClass("selected");
+							//$(rectButton).addClass("selected");
+							rectButton.setAttributeNS(null,"class","selected");
 						</script>
 					</onentry>
 					<onexit>
 						<script>
-							$(rectButton).removeClass("selected");
+							//$(rectButton).removeClass("selected");
+							rectButton.removeAttributeNS(null,"class");
 						</script>
 					</onexit>
 
@@ -413,7 +419,8 @@ In both:
 				<state id="after_mousedown_with_shift_key_on_selected_nodes">
 					<transition target="ready" event="mouseup">
 						<script>
-							$(clickedNode).removeClass("selected");
+							//$(clickedNode).removeClass("selected");
+							clickedNode.removeAttributeNS(null,"class");
 
 							selectedNodes.splice(selectedNodes.indexOf(clickedNode),1);
 						</script>
@@ -430,16 +437,20 @@ In both:
 				<state id="after_mousedown_on_nonselected_nodes">
 					<transition target="ready" event="mouseup">
 						<script>
-							$(selectedNodes).removeClass("selected");
-							$(clickedNode).addClass("selected");
+							//$(selectedNodes).removeClass("selected");
+							//$(clickedNode).addClass("selected");
+							selectedNodes.forEach(function(n){n.removeAttributeNS(null,"class")})
+							clickedNode.setAttributeNS(null,"class","selected");
 						</script>
 						<assign location="selectedNodes" expr="[clickedNode]"/>
 						<send event="NODES_SELECTED_WITH_CLICK"/>
 					</transition>
 					<transition target="dragging" event="mousemove" cond="In(transform_tool_selected)">
 						<script>
-							$(selectedNodes).removeClass("selected");
-							$(clickedNode).addClass("selected");
+							//$(selectedNodes).removeClass("selected");
+							//$(clickedNode).addClass("selected");
+							selectedNodes.forEach(function(n){n.removeAttributeNS(null,"class","selected")})
+							clickedNode.setAttributeNS(null,"class","selected");
 						</script>
 						<assign location="selectedNodes" expr="[clickedNode]"/>
 						<send event="NODES_SELECTED_WITH_DRAG"/>
@@ -454,7 +465,8 @@ In both:
 				<state id="after_mousedown_with_shift_key_on_nonselected_nodes">
 					<transition target="ready" event="mouseup">
 						<script>
-							$(clickedNode).addClass("selected");
+							//$(clickedNode).addClass("selected");
+							clickedNode.setAttributeNS(null,"class","selected");
 
 							selectedNodes.push(clickedNode);
 						</script>
@@ -471,7 +483,8 @@ In both:
 				<state id="after_mousedown_on_canvas">
 					<transition target="ready" event="mouseup">
 						<script>
-							$(selectedNodes).removeClass("selected");
+							//$(selectedNodes).removeClass("selected");
+							selectedNodes.forEach(function(n){n.removeAttributeNS(null,"class")});
 						</script>
 						<assign location="selectedNodes" expr="[]"/>
 						<send event="CHECK_NODES"/>
@@ -595,14 +608,16 @@ In both:
 				
 				<transition target="ready" event="mouseup">
 					<script>
-						$(selectedNodes).removeClass("selected");
+						//$(selectedNodes).removeClass("selected");
+						selectedNodes.forEach(function(n){n.removeAttributeNS(null,"class")});
 					</script>
 					<script>
 						selectedNodes = [nodeBeingDrawn];
 
 						allNodes.push(nodeBeingDrawn);
 
-						$(nodeBeingDrawn).addClass("selected");
+						//$(nodeBeingDrawn).addClass("selected");
+						nodeBeingDrawn.setAttributeNS(null,"class","selected");
 					</script>
 				</transition>
 			</state>

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=984044&r1=984043&r2=984044&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
Tue Aug 10 14:21:34 2010
@@ -123,14 +123,21 @@
                   stroke:"black"
                 });
 
-		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)"
-		})
+								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)"
+								})
+
+/*
+								var backgroundRect = svg.rect(0,0,"100%","100%",{
+									stroke:"none",
+									fill:"white"
+								});
+*/
 
                 function hookUpDOMEvents(node,compiledStatechartInstance){
                   //hook up DOM events



Mime
View raw message