- Where Developers Learn, Share, & Build Careers
I have a problem with dealing with event dojox gfx
Consider the following code:.
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; Example & lt; / Title & gt; & Lt ;! - Load Dojo - & gt; & Lt; Script & gt; DojoConfig = {async: true, gfxRenderer: "svg, silverlight, vml" // svg becomes priority}; & Lt; / Script & gt; & Lt; Script src = "dojo / dojo.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Script & gt; ("Dojox / gfx", "dojox / gfx / movable", "dojo / domReady!", "Dojox / gfx / fx"], function (gfx, movable, dome, gfxfx) {var surface = Gfx.createSurface ("surface element", 400, 400); var rect = surface.createRect ({x: 30, y: 30, width: 100, height: 100}). Setfill ('blue'); rect.connect OtherRect = surface.createRect ({x: 30, Y: 30, width: 100, height: 50}.) SetFill ('red') ('onclick', function (e) {warning ('first'}} );}); & Lt; / Script & gt; & Lt ;! - Dome element that will become surface - & gt; & Lt; Div id = "surface element" & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt; Is there a way when I click on the red one to handle the blue rectangle position? Just move the second rectangle in front of the event listener and then see it by the variable:
("Dojox / gfx", "dojox / gfx / movable", "dojo / domReady!", "Dojox / gfx / fx"], function (gfx, movable, dome, gfxfx) {Var surface = gfx.createSurface ("surface element", 400, 400); var rect = surface.createRect ({x: 30, y: 30, width: 100, height: 100}). Setfill ('blue' '' '' '' '' ''; '/ OtherRect is available here console.log (otherRect);});});
Comments
Post a Comment