VMLDrawing.js revision 828c58761d90445b8b9d20a82d85dc1479317f71
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * Draws a bezier curve.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @method curveTo
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} cp1x x-coordinate for the first control point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} cp1y y-coordinate for the first control point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} cp2x x-coordinate for the second control point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} cp2y y-coordinate for the second control point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} x x-coordinate for the end point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} y y-coordinate for the end point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync x = Math.round(x);
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync y = Math.round(y);
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync this._path += ' c ' + Math.round(cp1x) + ", " + Math.round(cp1y) + ", " + Math.round(cp2x) + ", " + Math.round(cp2y) + ", " + x + ", " + y;
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * Draws a quadratic bezier curve.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @method quadraticCurveTo
99f33ab590a3a65e0cd082dd8d67779efb9cc6c9vboxsync * @param {Number} cpx x-coordinate for the control point.
99f33ab590a3a65e0cd082dd8d67779efb9cc6c9vboxsync * @param {Number} cpy y-coordinate for the control point.
99f33ab590a3a65e0cd082dd8d67779efb9cc6c9vboxsync * @param {Number} x x-coordinate for the end point.
99f33ab590a3a65e0cd082dd8d67779efb9cc6c9vboxsync * @param {Number} y y-coordinate for the end point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * Draws a rectangle.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @method drawRect
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} x x-coordinate
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} y y-coordinate
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} w width
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} h height
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync drawRect: function(x, y, w, h) {
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync this.lineTo(x + w, y);
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync this.lineTo(x + w, y + h);
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync this.lineTo(x, y + h);
99f33ab590a3a65e0cd082dd8d67779efb9cc6c9vboxsync return this;
99f33ab590a3a65e0cd082dd8d67779efb9cc6c9vboxsync * Draws a rectangle with rounded corners.
99f33ab590a3a65e0cd082dd8d67779efb9cc6c9vboxsync * @method drawRect
99f33ab590a3a65e0cd082dd8d67779efb9cc6c9vboxsync * @param {Number} x x-coordinate
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} y y-coordinate
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} w width
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} h height
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} ew width of the ellipse used to draw the rounded corners
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} eh height of the ellipse used to draw the rounded corners
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync this.quadraticCurveTo(x + w, y + h, x + w, y + h - eh);
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync return this;
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * Draws a wedge.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} x x-coordinate of the wedge's center point
99f33ab590a3a65e0cd082dd8d67779efb9cc6c9vboxsync * @param {Number} y y-coordinate of the wedge's center point
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} startAngle starting angle in degrees
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} arc sweep of the wedge. Negative values draw clockwise.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} radius radius of wedge. If [optional] yRadius is defined, then radius is the x radius.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} yRadius [optional] y radius for wedge.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync drawWedge: function(x, y, startAngle, arc, radius, yRadius)
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync this._path += this._getWedgePath({x:x, y:y, startAngle:startAngle, arc:arc, radius:radius, yRadius:yRadius});
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync return this;
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * Generates a path string for a wedge shape
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @method _getWedgePath
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Object} config attributes used to create the path
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @return String
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync path = " m " + x + " " + y + " ae " + x + " " + y + " " + radius + " " + yRadius + " " + startAngle + " " + arc;
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * Completes a drawing operation.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @method end
99f33ab590a3a65e0cd082dd8d67779efb9cc6c9vboxsync end: function() {
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * Draws a line segment using the current line style from the current drawing position to the specified x and y coordinates.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @method lineTo
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} point1 x-coordinate for the end point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} point2 y-coordinate for the end point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync if (typeof point1 === 'string' || typeof point1 === 'number') {
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync this._path += ' ' + Math.round(args[i][0]) + ', ' + Math.round(args[i][1]);
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync return this;
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * Moves the current drawing position to specified x and y coordinates.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @method moveTo
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} x x-coordinate for the end point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} y y-coordinate for the end point.
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync moveTo: function(x, y) {
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync this._path += ' m ' + Math.round(x) + ', ' + Math.round(y);
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * Updates the size of the graphics object
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @method _trackSize
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} w width
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync * @param {Number} h height
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync _trackSize: function(w, h) {