参考例子里的方法去加载图片 使用SuperMap.Layer.Graphics调用会报Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)'
graphicLayer = new SuperMap.Layer.Graphics("Graphic Layer", null, {hitDetection: true, useCanvasEvent: false});
var selectGraphic = new SuperMap.Control.SelectGraphic(graphicLayer, {
onSelect: showPopup,
hover: false
});
var points = [];
var image = [];
var img = new Image();
img.src =obj.exhibitDatas[5].iconUrl;
img.onload = function () {
image.push(L.supermap.imageStyle({
img: img,
anchor: [16, 16]
}));
for(var i = 0; i<obj.exhibitDatas.length; i++){
var point= new SuperMap.Geometry.Point(obj.exhibitDatas[i].longitude, obj.exhibitDatas[i].latitude);
var pointVector = new SuperMap.Graphic(point);
pointVector.style={
image: image[0].getStyle()
};
pointVector.scope=obj.exhibitDatas[i];
points.push(pointVector)
}
graphicLayer.addGraphics(points);
map.addLayers([markerLayer, graphicLayer]);
map.addControl(selectGraphic);
selectGraphic.activate();
}