字符串中加换行符 "\n"
label:{
//文字标签
text: new Cesium.CallbackProperty((result) => {
let textTipsArr = textTips;
if (textTipsArr.length > 10) {
//模拟文字换行,将字符串拆成两段
let a = textTipsArr.slice(0, 8);
let b = textTipsArr.slice(8);
result = a + "\n" + b
} else {
result = textTipsArr
}
return result;
},false),
// text: ''+textTips,
font: '500 30px Helvetica',// 15pt monospace
scale: 0.6,
style: Cesium.LabelStyle.FILL,
fillColor: Cesium.Color.WHITE,
pixelOffset: new Cesium.Cartesian2(7, 13), //偏移量
showBackground: true,
backgroundColor: new Cesium.Color.fromCssColorString('#6ab4fff2'),
maximumScale: 0.6,
minimumScale: 0.6,
disableDepthTestDistance:99000000,
heightReference:Cesium.HeightReference.CLAMP_TO_GROUND,
}
标签:换行,0.6,result,textTipsArr,Cesium,new,label
From: https://www.cnblogs.com/hustshu/p/17150432.html