You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
720 B
31 lines
720 B
|
4 years ago
|
export default function registerTask (lf) {
|
||
|
|
lf.register('task', ({ RectNode, RectNodeModel, h }) => {
|
||
|
|
class View extends RectNode {
|
||
|
|
getShape() {
|
||
|
|
const style = this.getShapeStyle();
|
||
|
|
console.log(style);
|
||
|
|
const { width, height } = style;
|
||
|
|
const { x, y } = this.getAttributes();
|
||
|
|
const position = {
|
||
|
|
x: x - width / 2,
|
||
|
|
y: y- height / 2,
|
||
|
|
}
|
||
|
|
return h("rect", {
|
||
|
|
...style,
|
||
|
|
...position,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
class Model extends RectNodeModel {
|
||
|
|
constructor (data, graphModel) {
|
||
|
|
super(data, graphModel)
|
||
|
|
this.radius = 20;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return {
|
||
|
|
view: View,
|
||
|
|
model: Model
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|