update at 2026-01-23 12:07:22

This commit is contained in:
douboer@gmail.com
2026-01-23 12:07:22 +08:00
parent 405576c7c3
commit f0234d1d8a
9 changed files with 45 additions and 25 deletions

View File

@@ -19,6 +19,7 @@ import { SectorBuilder } from '../sectorBuilder';
import { buildDegreeRing } from '../degreeRing';
import { loadCenterIcon } from '../centerIcon';
// 只有扇区层会生成扇区几何,其它层仍参与层级顺序。
const isSectorLayer = (layer: LayerConfig): layer is SectorLayerConfig =>
layer.type !== 'centerIcon' && layer.type !== 'degreeRing';
@@ -67,8 +68,10 @@ export function useLuopan(
textRadialPosition: textRadialPosition.value,
insetDistance: configObj.insetDistance,
});
const sectorLayers = configObj.layers.filter(isSectorLayer);
return sectorLayers.flatMap((layer, index) => builder.buildLayer(layer, index));
// 层索引与配置顺序一致(`centerIcon`/`degreeRing` 仍占位)。
return configObj.layers.flatMap((layer, index) =>
isSectorLayer(layer) ? builder.buildLayer(layer, index) : []
);
};
const loadConfig = async () => {
@@ -156,6 +159,7 @@ export function useLuopan(
const outerMost = computed(() => {
if (!config.value) return 0;
// 取扇区层与刻度环中的最大半径。
const radii = sectorLayers.value.map((layer) => layer.rOuter);
const degreeRingLayer = findDegreeRingLayer(config.value.layers);
if (degreeRingLayer) {