Source: core/drawing/engine/svg/svgElement.js

  1. /**
  2. * @fileoverview SVG super class.
  3. * @private
  4. */
  5. goog.provide('xrx.svg.Element');
  6. goog.require('xrx.engine.Element');
  7. /**
  8. * SVG super class.
  9. * @param {SVGElement} element An SVG element.
  10. * @constructor
  11. * @private
  12. */
  13. xrx.svg.Element = function(element) {
  14. goog.base(this);
  15. /**
  16. * The SVG element.
  17. * @type {SVGElement}
  18. */
  19. this.element_ = element;
  20. };
  21. goog.inherits(xrx.svg.Element, xrx.engine.Element);
  22. /**
  23. * Returns the SVG element.
  24. * @return {SVGElement} The SVG element.
  25. */
  26. xrx.svg.Element.prototype.getElement = function() {
  27. return this.element_;
  28. };
  29. xrx.svg.Element.prototype.applyTransform = function(matrix) {
  30. if (!matrix) return;
  31. var s = 'matrix(' + matrix.m00_ + ',' + matrix.m10_ +
  32. ',' + matrix.m01_ + ',' + matrix.m11_ +
  33. ',' + matrix.m02_ + ',' + matrix.m12_ + ')';
  34. this.element_.setAttribute('transform', s);
  35. };
  36. xrx.svg.Element.prototype.disposeInternal = function() {
  37. goog.dom.removeNode(this.element_);
  38. this.element_.style = null;
  39. this.element_ = null;
  40. goog.base(this, 'disposeInternal');
  41. };