pattern.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. define(function(require, exports, module) {
  2. var Resource = require('./resource');
  3. var ShapeContainer = require('./shapecontainer');
  4. var svg = require('./svg');
  5. return require('../core/class').createClass('PatternBrush', {
  6. base: Resource,
  7. mixins: [ShapeContainer],
  8. constructor: function(paper) {
  9. this.callBase('pattern', paper);
  10. this.node.setAttribute('patternUnits', 'userSpaceOnUse');
  11. },
  12. setX: function(x) {
  13. this.x = x;
  14. this.node.setAttribute('x', x);
  15. return this;
  16. },
  17. setY: function(y) {
  18. this.y = y;
  19. this.node.setAttribute('y', y);
  20. return this;
  21. },
  22. setWidth: function(width) {
  23. this.width = width;
  24. this.node.setAttribute('width', width);
  25. return this;
  26. },
  27. setHeight: function(height) {
  28. this.height = height;
  29. this.node.setAttribute('height', height);
  30. return this;
  31. },
  32. getWidth: function() {
  33. return this.width;
  34. },
  35. getHeight: function() {
  36. return this.height;
  37. }
  38. });
  39. });