SGraphyCircleItem.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = function (d, b) {
  3. extendStatics = Object.setPrototypeOf ||
  4. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6. return extendStatics(d, b);
  7. };
  8. return function (d, b) {
  9. extendStatics(d, b);
  10. function __() { this.constructor = d; }
  11. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12. };
  13. })();
  14. import { SGraphyItem } from '@sybotan-web/graphy';
  15. import { SRect } from "@sybotan-web/base";
  16. import { SColor } from "@sybotan-web/draw";
  17. /**
  18. * 圆Item类
  19. *
  20. */
  21. var SGraphyCircleItem = /** @class */ (function (_super) {
  22. __extends(SGraphyCircleItem, _super);
  23. /**
  24. * 构造函数
  25. *
  26. * @param r 圆半径
  27. * @param width 圆线的宽度
  28. * @param color 圆线的颜色
  29. * @param fillColor 圆填充的颜色
  30. * @param parent
  31. */
  32. function SGraphyCircleItem(parent, r, fillColor, color, width) {
  33. if (fillColor === void 0) { fillColor = SColor.White; }
  34. if (color === void 0) { color = SColor.Black; }
  35. if (width === void 0) { width = 1; }
  36. var _this = _super.call(this, parent) || this;
  37. _this.fillColor = SColor.White;
  38. _this.color = SColor.Black;
  39. _this.width = 1;
  40. _this.r = r;
  41. _this.color = color;
  42. _this.fillColor = fillColor;
  43. _this.width = width;
  44. return _this;
  45. } // Constructor()
  46. /**
  47. * Item对象边界区域
  48. *
  49. * @return SRect
  50. */
  51. SGraphyCircleItem.prototype.boundingRect = function () {
  52. return new SRect(-this.r, -this.r, 2 * this.r, 2 * this.r);
  53. }; // Function boundingRect()
  54. /**
  55. * Item绘制操作
  56. *
  57. * @param painter painter对象
  58. * @param rect 绘制区域
  59. */
  60. SGraphyCircleItem.prototype.onDraw = function (painter, rect) {
  61. // painter.pen = new SPen(new SColor("#FF0000"), 22);
  62. painter.pen.color = this.color;
  63. painter.brush.color = this.fillColor;
  64. painter.drawCircle(500, 500, this.r);
  65. };
  66. return SGraphyCircleItem;
  67. }(SGraphyItem)); // Class SGraphyCircleItem
  68. export default SGraphyCircleItem;