    else                     rubberbandRect.top = loc.y;
    }

    function drawRubberbandShape(loc, sides, startAngle) {
        var polygon = new Polygon(mousedown.x, mousedown.y,
            rubberbandRect.width,
            parseInt(sidesSelect.value),
            (Math.PI / 180) * parseInt(startAngleSelect.value),
            context.strokeStyle,
            context.fillStyle,
            fillCheckbox.checked);
        drawPolygon(polygon);

        if (!dragging) {
            polygons.push(polygon);