views:

22

answers:

0

How to make google closure graphics elements draggable and respond to events otherwise?

Here's what I have so far. I have the circle, but can't drag it yet :).

Thanks.

goog.require('goog.dom');
goog.require('goog.graphics');
goog.require('goog.events');
goog.require('goog.fx.Dragger');
goog.provide('graphics_test');

graphics_test = function(){
    var canvas = goog.dom.createDom('div', {'id':'canvas'});
    goog.dom.appendChild(document.body, canvas);
    var g = goog.graphics.createGraphics(600,400);
    var fill = new goog.graphics.SolidFill('yellow');
    var stroke = new goog.graphics.Stroke(1,'black');
    circle = g.drawCircle(300, 200, 50, stroke, fill);
    var dragger = new goog.fx.Dragger(circle,circle);
    g.render(goog.dom.$('canvas'));
};