通过S3MInstanceCollection.add批量添加小品时只有第一个小品能被点击选中,后面的小品无法被选中且有时候拉近了会直接消失掉,代码为官网addSymbols例子的代码,其中我只额外添加了一个固定位置
handlerPoint.drawEvt.addEventListener(function (result) {
handlerPoint.clear();
var point = result.object;
var color = Cesium.Color.WHITE;
s3mInstanceColc.add(defaultUrl, [{
position: point.position,
hpr: new Cesium.HeadingPitchRoll(0, 0, 0),
scale: new Cesium.Cartesian3(1, 1, 1),
color: color
}, {
position: {
x: 4172940.5339382663,
y: 966793.2318473526,
z: 4725821.849542391
},
hpr: new Cesium.HeadingPitchRoll(0, 0, 0),
scale: new Cesium.Cartesian3(1, 1, 1),
color: color
}]);
var colorStr = color.toCssColorString();
viewModel.material = colorStr;
$('#colorPicker').css({
color: colorStr
});
$("img").removeClass("selected");
handlerPoint && handlerPoint.deactivate();
tooltip.setVisible(false);
});