update at 2026-01-22 20:01:21

This commit is contained in:
douboer@gmail.com
2026-01-22 20:01:21 +08:00
parent a3e77045ac
commit 9160bc1a70
4 changed files with 13 additions and 1 deletions

View File

@@ -18,17 +18,23 @@ const ensureTrailingSlash = (input: string): string =>
interface SectorBuilderOptions {
textRadialPosition?: TextRadialPosition;
svgIconPath?: string;
insetDistance?: number;
}
export class SectorBuilder {
private colorResolver: ColorResolver;
private textRadialPosition: TextRadialPosition;
private svgIconPath: string;
private insetDistance: number;
constructor(colorResolver: ColorResolver, options: SectorBuilderOptions = {}) {
this.colorResolver = colorResolver;
this.textRadialPosition = options.textRadialPosition ?? 'middle';
this.svgIconPath = ensureTrailingSlash(options.svgIconPath ?? 'src/assets/icons/');
this.insetDistance =
typeof options.insetDistance === 'number'
? Math.max(0, options.insetDistance)
: SECTOR_INSET_DISTANCE;
}
buildLayer(layer: SectorLayerConfig, layerIndex: number): Sector[] {
@@ -57,7 +63,7 @@ export class SectorBuilder {
layer.rOuter,
aStart,
aEnd,
SECTOR_INSET_DISTANCE
this.insetDistance
)
: undefined;