Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initialize() {
var map = this.props.map;
if (!map) {
return;
}
const update = this.canvasLayerUpdate.bind(this);
if (this.canvasLayer) {
this.canvasLayer.draw();
} else {
this.canvasLayer = new baiduMapCanvasLayer({
zIndex: this.props.zIndex,
map,
update() {
update(this);
}
});
if (this.props.onClick) {
map.addEventListener('click', (e) => {
var isClick = false;
if (this.props.roadPaths) {
for (var i = 0; i < this.props.roadPaths.length; i++) {
var roadPath = this.props.roadPaths[i];
isClick = this.isClick(map, e.pixel, roadPath);
if (isClick) {
this.props.onClick(i);