Skip to content

openlayer MultiLineString 设置 text 重复重叠 #54

Description

@YBFACC
const Paths: [number, number][][] = []

const feature = new Feature({
	geometry: new MultiLineString(Paths),
})

feature.setStyle(new Style({
	fill: new Fill({
		color: "rgba(193, 43, 255, 0)",
	}),
	stroke: new Stroke({
		color: 'rgb(193, 43, 255)',
		width: 3
	}),
	text: new Text({
		text: 'aaaa',
		font: '20px Microsoft YaHei',
		fill: new Fill({
			color: 'red',
		}),
		overflow: true,
	})
}))

// 将 feature 添加到 layer

这里猜测 MultiLineString 的 style 会对每个 LineString 都设置。
如下图,text 会大量重叠。

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions