function getPosition(myshape) { var shape, trans, x, y; shape = myshape.getShape() trans = myshape.getTransform(); if (trans == null) { // will be null if it hasn't yet moved trans = { dx: 0, dy: 0 }; } x = shape.x + trans.dx; y = shape.y + trans.dy; return {x, y}; } function exampleUse() { var surface, rect, position; surface = dojox.gfx.createSurface(...); rect = surface.createRect(...) new dojox.gfx.Moveable(rect); // ... later, after user has had a chance to move it ... position = getPosition(rect); }
Programming Tips - How do I get the current position of a dojox.gfx object?
Date: 2009aug6
Language: javaScript
Libary: dojo
Q. How do I get the current position of a dojox.gfx object?
A. This function shows you how: