Path: blob/trunk/third_party/closure/goog/graphics/ext/ellipse.js
2868 views
// Copyright 2007 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.131415/**16* @fileoverview A thick wrapper around ellipses.17* @author [email protected] (Robby Walker)18*/192021goog.provide('goog.graphics.ext.Ellipse');2223goog.require('goog.graphics.ext.StrokeAndFillElement');24252627/**28* Wrapper for a graphics ellipse element.29* @param {goog.graphics.ext.Group} group Parent for this element.30* @constructor31* @extends {goog.graphics.ext.StrokeAndFillElement}32* @final33*/34goog.graphics.ext.Ellipse = function(group) {35// Initialize with some stock values.36var wrapper = group.getGraphicsImplementation().drawEllipse(371, 1, 2, 2, null, null, group.getWrapper());38goog.graphics.ext.StrokeAndFillElement.call(this, group, wrapper);39};40goog.inherits(41goog.graphics.ext.Ellipse, goog.graphics.ext.StrokeAndFillElement);424344/**45* Redraw the ellipse. Called when the coordinate system is changed.46* @protected47* @override48*/49goog.graphics.ext.Ellipse.prototype.redraw = function() {50goog.graphics.ext.Ellipse.superClass_.redraw.call(this);5152// Our position is already transformed in transform_, but because this is an53// ellipse we need to position the center.54var xRadius = this.getWidth() / 2;55var yRadius = this.getHeight() / 2;56var wrapper = this.getWrapper();57wrapper.setCenter(xRadius, yRadius);58wrapper.setRadius(xRadius, yRadius);59};606162