diff options
Diffstat (limited to 'js/dojo-1.7.2/dojox/gfx/demos/circles2.html')
| -rw-r--r-- | js/dojo-1.7.2/dojox/gfx/demos/circles2.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/js/dojo-1.7.2/dojox/gfx/demos/circles2.html b/js/dojo-1.7.2/dojox/gfx/demos/circles2.html new file mode 100644 index 0000000..67afacb --- /dev/null +++ b/js/dojo-1.7.2/dojox/gfx/demos/circles2.html @@ -0,0 +1,69 @@ +<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> +<head> +<title>dojox.gfx: 2 draggable circles</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<style type="text/css"> + @import "../../../dojo/resources/dojo.css"; + @import "../../../dijit/tests/css/dijitTests.css"; +</style> +<script type="text/javascript" src="../../../dojo/dojo.js"></script> +<script type="text/javascript"> + +dojo.require("dojox.gfx"); +dojo.require("dojox.gfx.move"); + +var container = null, + surface = null, + surface_size = null; + +function makeCircles(){ + // our geometry + var x1 = 100, y1 = 100, x2 = 400, y2 = 400, r = 50; + + // our shapes + var line = surface.createLine({x1: x1, y1: y1, x2: x2, y2: y2}).setStroke("red"), + circle1 = surface.createCircle({cx: x1, cy: y1, r: r}).setStroke("red").setFill("white"), + circle2 = surface.createCircle({cx: x2, cy: y2, r: r}).setStroke("red").setFill("white"); + + // circle movers + var m1 = new dojox.gfx.Moveable(circle1), + m2 = new dojox.gfx.Moveable(circle2); + + // custom event processing + dojo.connect(m1, "onMoved", function(mover, shift){ + var o = line.getShape(); + line.setShape({x1: o.x1 + shift.dx, y1: o.y1 + shift.dy, x2: o.x2, y2: o.y2}); + }); + dojo.connect(m2, "onMoved", function(mover, shift){ + var o = line.getShape(); + line.setShape({x1: o.x1, y1: o.y1, x2: o.x2 + shift.dx, y2: o.y2 + shift.dy}); + }); +} + +function initGfx(){ + container = dojo.byId("gfx_holder"); + surface = dojox.gfx.createSurface(container, 500, 500); + surface_size = {width: 500, height: 500}; + + makeCircles(); + + // cancel text selection and text dragging + dojo.connect(container, "ondragstart", dojo, "stopEvent"); + dojo.connect(container, "onselectstart", dojo, "stopEvent"); +} + +dojo.addOnLoad(initGfx); + +</script> + +<style type="text/css"> +.movable { cursor: pointer; } +</style> + +</head> +<body> +<h1>dojox.gfx: 2 draggable circles</h1> +<p>Warning: Canvas renderer doesn't implement event handling.</p> +<div id="gfx_holder" style="width: 500px; height: 500px;"></div> +</body> +</html> |
