调整碰撞参数,减少文字闪烁

This commit is contained in:
JIANG
2025-10-16 18:02:42 +08:00
parent 78fa4c84fc
commit 6ddce65445

View File

@@ -428,15 +428,14 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
showJunctionTextLayer && currentZoom >= 15 && currentZoom <= 24, showJunctionTextLayer && currentZoom >= 15 && currentZoom <= 24,
extensions: [new CollisionFilterExtension()], extensions: [new CollisionFilterExtension()],
collisionTestProps: { collisionTestProps: {
sizeScale: 2, // 增加碰撞检测的尺寸以提供更大间距 sizeScale: 3, // 增加碰撞检测的尺寸以提供更大间距
}, },
// 可读性设置
characterSet: "auto",
fontSettings: { fontSettings: {
sdf: true, sdf: true,
fontSize: 64, // 字体图集大小,默认 64 fontSize: 64,
buffer: 6, // 字符间距缓冲,默认 4 buffer: 6,
radius: 12, // SDF 半径,默认 12
cutoff: 0.25, // 控制字符粗细,默认 0.25
smoothing: 0.1, // 边缘平滑度,默认 0.1
}, },
outlineWidth: 10, outlineWidth: 10,
outlineColor: [255, 255, 255, 255], outlineColor: [255, 255, 255, 255],
@@ -458,15 +457,14 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
visible: showPipeTextLayer && currentZoom >= 15 && currentZoom <= 24, visible: showPipeTextLayer && currentZoom >= 15 && currentZoom <= 24,
extensions: [new CollisionFilterExtension()], extensions: [new CollisionFilterExtension()],
collisionTestProps: { collisionTestProps: {
sizeScale: 2, // 增加碰撞检测的尺寸以提供更大间距 sizeScale: 3, // 增加碰撞检测的尺寸以提供更大间距
}, },
// 可读性设置
characterSet: "auto",
fontSettings: { fontSettings: {
sdf: true, sdf: true,
fontSize: 64, // 字体图集大小,默认 64 fontSize: 64,
buffer: 6, // 字符间距缓冲,默认 4 buffer: 6,
radius: 12, // SDF 半径,默认 12
cutoff: 0.25, // 控制字符粗细,默认 0.25
smoothing: 0.1, // 边缘平滑度,默认 0.1
}, },
outlineWidth: 10, outlineWidth: 10,
outlineColor: [255, 255, 255, 255], outlineColor: [255, 255, 255, 255],