NodeTask.ts 636 B

12345678910111213141516171819202122232425
  1. import { RectNode, RectNodeModel, h } from "@logicflow/core";
  2. class TaskNode extends RectNode {
  3. getShare() {
  4. const { model } = this.props;
  5. const { width, height, x, y } = model;
  6. const position = {
  7. x: x - width / 2,
  8. y: y - height / 2,
  9. }
  10. const style = model.getNodeStyle();
  11. return h('rect', { ...style, ...position });
  12. }
  13. }
  14. class TaskNodeModel extends RectNodeModel {
  15. constructor(data, graphModel) {
  16. super(data, graphModel);
  17. this.radius = 20;
  18. }
  19. }
  20. export default {
  21. type: 'task-node',
  22. view: TaskNode,
  23. model: TaskNodeModel,
  24. }