123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 |
- goog.provide('goog.graphics.VmlEllipseElement');
- goog.provide('goog.graphics.VmlGroupElement');
- goog.provide('goog.graphics.VmlImageElement');
- goog.provide('goog.graphics.VmlPathElement');
- goog.provide('goog.graphics.VmlRectElement');
- goog.provide('goog.graphics.VmlTextElement');
- goog.require('goog.dom');
- goog.require('goog.graphics.EllipseElement');
- goog.require('goog.graphics.GroupElement');
- goog.require('goog.graphics.ImageElement');
- goog.require('goog.graphics.PathElement');
- goog.require('goog.graphics.RectElement');
- goog.require('goog.graphics.TextElement');
- goog.graphics.vmlGetElement_ = function() {
- this.element_ = this.getGraphics().getVmlElement(this.id_) || this.element_;
- return this.element_;
- };
- goog.graphics.VmlGroupElement = function(element, graphics) {
- this.id_ = element.id;
- goog.graphics.GroupElement.call(this, element, graphics);
- };
- goog.inherits(goog.graphics.VmlGroupElement, goog.graphics.GroupElement);
- goog.graphics.VmlGroupElement.prototype.getElement =
- goog.graphics.vmlGetElement_;
- goog.graphics.VmlGroupElement.prototype.clear = function() {
- goog.dom.removeChildren(this.getElement());
- };
- goog.graphics.VmlGroupElement.prototype.isRootElement_ = function() {
- return this.getGraphics().getCanvasElement() == this;
- };
- goog.graphics.VmlGroupElement.prototype.setSize = function(width, height) {
- var element = this.getElement();
- var style = element.style;
- style.width = goog.graphics.VmlGraphics.toSizePx(width);
- style.height = goog.graphics.VmlGraphics.toSizePx(height);
- element.coordsize = goog.graphics.VmlGraphics.toSizeCoord(width) + ' ' +
- goog.graphics.VmlGraphics.toSizeCoord(height);
-
- if (!this.isRootElement_()) {
- element.coordorigin = '0 0';
- }
- };
- goog.graphics.VmlEllipseElement = function(
- element, graphics, cx, cy, rx, ry, stroke, fill) {
- this.id_ = element.id;
- goog.graphics.EllipseElement.call(this, element, graphics, stroke, fill);
-
-
- this.cx = cx;
-
- this.cy = cy;
-
- this.rx = rx;
-
- this.ry = ry;
- };
- goog.inherits(goog.graphics.VmlEllipseElement, goog.graphics.EllipseElement);
- goog.graphics.VmlEllipseElement.prototype.getElement =
- goog.graphics.vmlGetElement_;
- goog.graphics.VmlEllipseElement.prototype.setCenter = function(cx, cy) {
- this.cx = cx;
- this.cy = cy;
-
- goog.graphics.VmlGraphics.setPositionAndSize(
- this.getElement(), cx - this.rx, cy - this.ry, this.rx * 2, this.ry * 2);
- };
- goog.graphics.VmlEllipseElement.prototype.setRadius = function(rx, ry) {
- this.rx = rx;
- this.ry = ry;
-
- goog.graphics.VmlGraphics.setPositionAndSize(
- this.getElement(), this.cx - rx, this.cy - ry, rx * 2, ry * 2);
- };
- goog.graphics.VmlRectElement = function(element, graphics, stroke, fill) {
- this.id_ = element.id;
- goog.graphics.RectElement.call(this, element, graphics, stroke, fill);
- };
- goog.inherits(goog.graphics.VmlRectElement, goog.graphics.RectElement);
- goog.graphics.VmlRectElement.prototype.getElement =
- goog.graphics.vmlGetElement_;
- goog.graphics.VmlRectElement.prototype.setPosition = function(x, y) {
- var style = this.getElement().style;
- style.left =
- goog.graphics.VmlGraphics.toPosPx(x);
- style.top =
- goog.graphics.VmlGraphics.toPosPx(y);
- };
- goog.graphics.VmlRectElement.prototype.setSize = function(width, height) {
- var style = this.getElement().style;
- style.width = goog.graphics.VmlGraphics.toSizePx(width);
- style.height = goog.graphics.VmlGraphics.toSizePx(height);
- };
- goog.graphics.VmlPathElement = function(element, graphics, stroke, fill) {
- this.id_ = element.id;
- goog.graphics.PathElement.call(this, element, graphics, stroke, fill);
- };
- goog.inherits(goog.graphics.VmlPathElement, goog.graphics.PathElement);
- goog.graphics.VmlPathElement.prototype.getElement =
- goog.graphics.vmlGetElement_;
- goog.graphics.VmlPathElement.prototype.setPath = function(path) {
-
- goog.graphics.VmlGraphics.setAttribute(
- this.getElement(), 'path',
-
- goog.graphics.VmlGraphics.getVmlPath(path));
- };
- goog.graphics.VmlTextElement = function(element, graphics, stroke, fill) {
- this.id_ = element.id;
- goog.graphics.TextElement.call(this, element, graphics, stroke, fill);
- };
- goog.inherits(goog.graphics.VmlTextElement, goog.graphics.TextElement);
- goog.graphics.VmlTextElement.prototype.getElement =
- goog.graphics.vmlGetElement_;
- goog.graphics.VmlTextElement.prototype.setText = function(text) {
-
- goog.graphics.VmlGraphics.setAttribute(
- (this.getElement().childNodes[1]), 'string',
- text);
- };
- goog.graphics.VmlImageElement = function(element, graphics) {
- this.id_ = element.id;
- goog.graphics.ImageElement.call(this, element, graphics);
- };
- goog.inherits(goog.graphics.VmlImageElement, goog.graphics.ImageElement);
- goog.graphics.VmlImageElement.prototype.getElement =
- goog.graphics.vmlGetElement_;
- goog.graphics.VmlImageElement.prototype.setPosition = function(x, y) {
- var style = this.getElement().style;
- style.left =
- goog.graphics.VmlGraphics.toPosPx(x);
- style.top =
- goog.graphics.VmlGraphics.toPosPx(y);
- };
- goog.graphics.VmlImageElement.prototype.setSize = function(width, height) {
- var style = this.getElement().style;
- style.width = goog.graphics.VmlGraphics.toPosPx(width);
- style.height = goog.graphics.VmlGraphics.toPosPx(height);
- };
- goog.graphics.VmlImageElement.prototype.setSource = function(src) {
-
- goog.graphics.VmlGraphics.setAttribute(this.getElement(), 'src', src);
- };
|