custom.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  2. var Shape = require('../shape');
  3. var Custom =
  4. /*#__PURE__*/
  5. function (_Shape) {
  6. _inheritsLoose(Custom, _Shape);
  7. function Custom() {
  8. return _Shape.apply(this, arguments) || this;
  9. }
  10. var _proto = Custom.prototype;
  11. _proto._initProperties = function _initProperties() {
  12. _Shape.prototype._initProperties.call(this);
  13. this._attrs.canFill = true;
  14. this._attrs.canStroke = true;
  15. this._attrs.createPath = null;
  16. this._attrs.type = 'custom';
  17. };
  18. _proto.createPath = function createPath(context) {
  19. var createPath = this.get('createPath');
  20. createPath && createPath.call(this, context);
  21. };
  22. _proto.calculateBox = function calculateBox() {
  23. var calculateBox = this.get('calculateBox');
  24. return calculateBox && calculateBox.call(this);
  25. };
  26. return Custom;
  27. }(Shape);
  28. Shape.Custom = Custom;
  29. module.exports = Custom;