witam,
chciałbym przerobić kod, za pomocą którego rysuję ołówkiem, na rysowanie prostokąta,okręgu(elipsy) i linii.
Kod
    // define a pencil brush for drawing free-hand lines
    var PencilBrush = new Class({
        initialize: function (lineWidth, drawingCxt) {
            this.lineWidth = lineWidth;

            // get the cursor associated with the pencil brush
            this.getCursor = function () {
                return "url(cursors/pencil_cursor.cur), crosshair";
            };

            this.setColour = function (colour) {
                drawingCxt.fillStyle = drawingCxt.strokeStyle = colour;
                drawingCxt.lineWidth = this.lineWidth;
                drawingCxt.lineCap = "round";
                drawingCxt.lineJoin = "round";
            };

            // draws a line to the x and y coordinates of the specified position
            function drawLine(position) {
                drawingCxt.lineTo(position.X, position.Y);
                drawingCxt.stroke();
            }

            this.startDrawing = function (position) {
                // start drawing by moving to the specified x and y coordinates
                drawingCxt.beginPath();
                drawingCxt.moveTo(position.X--, position.Y--);
                drawLine(position);
            };

            this.draw = function (position) {
                drawLine(position);
            };

            this.finishDrawing = function (position) {
                // draw the line to the finishing coordinates
                drawLine(position);
                drawingCxt.closePath();
            };
        }
    });


Pomoże ktooś ?