| CODENOTIFIER | HelpYou are not signed inSign in |
Project: dojo
Revision: 15165
Author: elazutkin
Date: 07 Sep 2008 23:28:14
Diff at Trac: http://trac.dojotoolkit.org/changeset/15165
Changes:gfx: fixes #7346, !strict, thx PetraRock!
Files:| ... | ...@@ -1005,6 +1005,11 @@ | |
| 1005 | 1005 | // shape: dojox.gfx.Shape: an VML shape object |
| 1006 | 1006 | if(this != shape.getParent()){ |
| 1007 | 1007 | this.rawNode.appendChild(shape.rawNode); |
| 1008 | if(!shape.getParent()){ | |
| 1009 | // reapply visual attributes | |
| 1010 | shape.setFill(shape.getFill()); | |
| 1011 | shape.setStroke(shape.getStroke()); | |
| 1012 | } | |
| 1008 | 1013 | //dojox.gfx.Group.superclass.add.apply(this, arguments); |
| 1009 | 1014 | //this.inherited(arguments); |
| 1010 | 1015 | dojox.gfx.shape.Container.add.apply(this, arguments); |
| ... | ...@@ -1,69 +0,0 @@ | |
| 1 | <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" > | |
| 2 | <head> | |
| 3 | <title>Dojo Unified 2D Graphics</title> | |
| 4 | <style type="text/css"> | |
| 5 | @import "../../../dojo/resources/dojo.css"; | |
| 6 | @import "../../../dijit/tests/css/dijitTests.css"; | |
| 7 | </style> | |
| 8 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| 9 | <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script> | |
| 10 | <!--<script type="text/javascript" src="../matrix.js"></script>--> | |
| 11 | <!--<script type="text/javascript" src="../util.js"></script>--> | |
| 12 | <!--<script type="text/javascript" src="../shape.js"></script>--> | |
| 13 | <!--<script type="text/javascript" src="../path.js"></script>--> | |
| 14 | <!--<script type="text/javascript" src="../vml.js"></script>--> | |
| 15 | <!--<script type="text/javascript" src="../svg.js"></script>--> | |
| 16 | <!--<script type="text/javascript" src="../silverlight.js"></script>--> | |
| 17 | <script type="text/javascript"> | |
| 18 | dojo.require("dojox.gfx"); | |
| 19 | ||
| 20 | var surface = null; | |
| 21 | var g1 = null; | |
| 22 | var g2 = null; | |
| 23 | var r1 = null; | |
| 24 | ||
| 25 | makeShapes = function(){ | |
| 26 | surface = dojox.gfx.createSurface(document.getElementById("test"), 500, 500); | |
| 27 | // make a checkerboard | |
| 28 | for(var i = 0; i < 500; i += 100){ | |
| 29 | for(var j = 0; j < 500; j += 100){ | |
| 30 | if(i % 200 == j % 200) { | |
| 31 | surface.createRect({ x: i, y: j }).setFill([255, 0, 0, 0.1]); | |
| 32 | } | |
| 33 | } | |
| 34 | } | |
| 35 | // create groups and shapes | |
| 36 | g1 = surface.createGroup(); | |
| 37 | g2 = surface.createGroup(); | |
| 38 | r1 = surface.createRect({x: 200, y: 200}).setFill("green").setStroke({}); | |
| 39 | g1.setTransform({dy: -100}); | |
| 40 | //g2.setTransform(dojox.gfx.matrix.rotateAt(-45, 250, 250)); | |
| 41 | g2.setTransform({dx: 100, dy: -100}); | |
| 42 | }; | |
| 43 | ||
| 44 | switchRect = function(){ | |
| 45 | var radio = document.getElementsByName("switch"); | |
| 46 | if(radio[0].checked){ | |
| 47 | surface.add(r1); | |
| 48 | }else if(radio[1].checked){ | |
| 49 | g1.add(r1); | |
| 50 | }else if(radio[2].checked){ | |
| 51 | g2.add(r1); | |
| 52 | } | |
| 53 | }; | |
| 54 | ||
| 55 | dojo.addOnLoad(makeShapes); | |
| 56 | ||
| 57 | </script> | |
| 58 | </head> | |
| 59 | <body> | |
| 60 | <h1>dojox.gfx Group tests</h1> | |
| 61 | <p> | |
| 62 | <input type="radio" name="switch" id="r1_s" checked="checked" onclick="switchRect()" /><label for="r1_s">Rectangle belongs to the surface</label><br /> | |
| 63 | <input type="radio" name="switch" id="r1_g1" onclick="switchRect()" /><label for="r1_g1">Rectangle belongs to the group #1</label><br /> | |
| 64 | <input type="radio" name="switch" id="r1_g2" onclick="switchRect()" /><label for="r1_g2">Rectangle belongs to the group #2</label> | |
| 65 | </p> | |
| 66 | <div id="test"></div> | |
| 67 | <p>That's all Folks!</p> | |
| 68 | </body> | |
| 69 | </html> |
| ... | ...@@ -0,0 +1,69 @@ | |
| 1 | <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" > | |
| 2 | <head> | |
| 3 | <title>Dojo Unified 2D Graphics</title> | |
| 4 | <style type="text/css"> | |
| 5 | @import "../../../dojo/resources/dojo.css"; | |
| 6 | @import "../../../dijit/tests/css/dijitTests.css"; | |
| 7 | </style> | |
| 8 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| 9 | <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script> | |
| 10 | <!--<script type="text/javascript" src="../matrix.js"></script>--> | |
| 11 | <!--<script type="text/javascript" src="../util.js"></script>--> | |
| 12 | <!--<script type="text/javascript" src="../shape.js"></script>--> | |
| 13 | <!--<script type="text/javascript" src="../path.js"></script>--> | |
| 14 | <!--<script type="text/javascript" src="../vml.js"></script>--> | |
| 15 | <!--<script type="text/javascript" src="../svg.js"></script>--> | |
| 16 | <!--<script type="text/javascript" src="../silverlight.js"></script>--> | |
| 17 | <script type="text/javascript"> | |
| 18 | dojo.require("dojox.gfx"); | |
| 19 | ||
| 20 | var surface = null; | |
| 21 | var g1 = null; | |
| 22 | var g2 = null; | |
| 23 | var r1 = null; | |
| 24 | ||
| 25 | makeShapes = function(){ | |
| 26 | surface = dojox.gfx.createSurface(document.getElementById("test"), 500, 500); | |
| 27 | // make a checkerboard | |
| 28 | for(var i = 0; i < 500; i += 100){ | |
| 29 | for(var j = 0; j < 500; j += 100){ | |
| 30 | if(i % 200 == j % 200) { | |
| 31 | surface.createRect({ x: i, y: j }).setFill([255, 0, 0, 0.1]); | |
| 32 | } | |
| 33 | } | |
| 34 | } | |
| 35 | // create groups and shapes | |
| 36 | g1 = surface.createGroup(); | |
| 37 | g2 = surface.createGroup(); | |
| 38 | r1 = surface.createRect({x: 200, y: 200}).setFill("green").setStroke({}); | |
| 39 | g1.setTransform({dy: -100}); | |
| 40 | //g2.setTransform(dojox.gfx.matrix.rotateAt(-45, 250, 250)); | |
| 41 | g2.setTransform({dx: 100, dy: -100}); | |
| 42 | }; | |
| 43 | ||
| 44 | switchRect = function(){ | |
| 45 | var radio = document.getElementsByName("switch"); | |
| 46 | if(radio[0].checked){ | |
| 47 | surface.add(r1); | |
| 48 | }else if(radio[1].checked){ | |
| 49 | g1.add(r1); | |
| 50 | }else if(radio[2].checked){ | |
| 51 | g2.add(r1); | |
| 52 | } | |
| 53 | }; | |
| 54 | ||
| 55 | dojo.addOnLoad(makeShapes); | |
| 56 | ||
| 57 | </script> | |
| 58 | </head> | |
| 59 | <body> | |
| 60 | <h1>dojox.gfx Group tests</h1> | |
| 61 | <p> | |
| 62 | <input type="radio" name="switch" id="r1_s" checked="checked" onclick="switchRect()" /><label for="r1_s">Rectangle belongs to the surface</label><br /> | |
| 63 | <input type="radio" name="switch" id="r1_g1" onclick="switchRect()" /><label for="r1_g1">Rectangle belongs to the group #1</label><br /> | |
| 64 | <input type="radio" name="switch" id="r1_g2" onclick="switchRect()" /><label for="r1_g2">Rectangle belongs to the group #2</label> | |
| 65 | </p> | |
| 66 | <div id="test"></div> | |
| 67 | <p>That's all Folks!</p> | |
| 68 | </body> | |
| 69 | </html> |
| ... | ...@@ -0,0 +1,49 @@ | |
| 1 | <html> | |
| 2 | <head> | |
| 3 | <title>Testing add/remove shape</title> | |
| 4 | <style type="text/css"> | |
| 5 | @import "../../../dojo/resources/dojo.css"; | |
| 6 | @import "../../../dijit/tests/css/dijitTests.css"; | |
| 7 | </style> | |
| 8 | <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script> | |
| 9 | <script type="text/javascript"> | |
| 10 | dojo.require("dojox.gfx"); | |
| 11 | dojo.require("dijit.form.CheckBox"); | |
| 12 | dojo.require("dojo.parser"); | |
| 13 | ||
| 14 | var surface = null, shape = null; | |
| 15 | ||
| 16 | createSurface = function(){ | |
| 17 | surface = dojox.gfx.createSurface("test", 300, 300); | |
| 18 | }; | |
| 19 | ||
| 20 | flip = function(){ | |
| 21 | if(dijit.byId("cb").checked){ | |
| 22 | if(!shape){ | |
| 23 | //shape = surface.createRect({x: 100, y: 100, width: 100, height: 100}) | |
| 24 | shape = surface.createCircle({cx: 150, cy : 150, r: 50}) | |
| 25 | .setFill("yellow").setStroke({color: "red", width: 3}); | |
| 26 | }else{ | |
| 27 | surface.add(shape); | |
| 28 | } | |
| 29 | }else{ | |
| 30 | surface.remove(shape); | |
| 31 | } | |
| 32 | } | |
| 33 | ||
| 34 | dojo.addOnLoad(createSurface); | |
| 35 | </script> | |
| 36 | ||
| 37 | ||
| 38 | </head> | |
| 39 | ||
| 40 | <body> | |
| 41 | <h1>Testing add/remove shape</h1> | |
| 42 | <p> | |
| 43 | <input type="checkbox" dojoType="dijit.form.CheckBox" id="cb" name="cb" onClick="flip()"> | |
| 44 | <label for="cb">Add shape to the surface</label> | |
| 45 | </p> | |
| 46 | <div id="test" style="width: 300px; height: 300px;"></div> | |
| 47 | <p>That's all Folks!</p> | |
| 48 | </body> | |
| 49 | </html> |