自定义线条样式未生效
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 230
- PR merge metrics
- No merged PRs in 30d
Description
import { subStyleProps, Quadratic } from '@antv/g6';
import { Circle, Line } from '@antv/g';
export class FlyMarkerCubic extends Quadratic {
getMarkerStyle(attributes) {
return { r: 5, fill: '#c3d5f9', offsetPath: this.shapeMap.key, ...subStyleProps(attributes, 'marker') };
}
getLineStyle(attributes) {
return { stroke: '#c3d5f9', offsetPath: this.shapeMap.key, ...subStyleProps(attributes, 'marker') };
}
onCreate() {
const marker = this.upsert('marker', Circle, this.getMarkerStyle(this.attributes), this);
marker?.animate([{ offsetDistance: 0 }, { offsetDistance: 1 }], {
duration: 3000,
iterations: Infinity,
});
const line = this.upsert('line_style', Line, this.getLineStyle(this.attributes), this);
line.animate([{ lineDashOffset: 20 }, { lineDashOffset: 0 }], {
duration: 500,
iterations: Infinity,
});
}
}
Contributor guide
Research direction
Start by reproducing the example with FlyMarkerCubic and inspect the getLineStyle and onCreate entry points, especially the Line created through upsert. Compare the requested custom line style with the rendered result and confirm the line styling is applied and remains visible during animation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100