选中对象A后触发改变颜色(符合预期)后点击空白处又恢复原来状态(不符合预期),再选中另一个对象B触发改变颜色后AB对象都改变颜色(不符合预期),后点击空白处对象未恢复(符合预期)
function ChangeColor(){
var layer3Ds = scene.get_layer3Ds();
layer3D = layer3Ds.get_item(0);
selection3Ds = scene.findSelection3Ds(true);
if (selection3Ds.length === 0) {
alert("没有对象被选中。");
return;
}
if (selection3Ds !== null) {
var regionRed = Number(document.getElementById("regionRed").value);
var regionGreen = Number(document.getElementById("regionGreen").value);
var regionBlue = Number(document.getElementById("regionBlue").value);
var id = selection3Ds[0].get_item(0);
var a=[Number(id)];
layer3D.setObjectsColor(a,new SuperMap.Web.Core.Color(regionRed, regionGreen, regionBlue, 255));
} else {
alert("没有对象被选中。");
}
}