|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { AutocompleteSearchCallback, AutocompleteSelectCallback, DrivingSearchCallback, HtmlRender, IAutocomplete, ICircle, IDriving, IInfoWindow, ILayer, ILngLat, IMap, IMapOptions, IMarker, IMarkerCluster, IMarkOptions, IMouseTool, IPixel, IPlaceSearch, IRenderClusterMarker, ISelf, ITileLayer, PixelRender, PlaceSearchCallback } from './map' |
|
|
|
|
import { AutocompleteSearchCallback, AutocompleteSelectCallback, ClickOptions, DrivingSearchCallback, EventCallback, HtmlRender, IAutocomplete, ICircle, IDriving, IInfoWindow, ILayer, ILngLat, IMap, IMapOptions, IMarker, IMarkerCluster, IMarkOptions, IMouseTool, IPixel, IPlaceSearch, IRenderClusterMarker, ISelf, ITileLayer, PixelRender, PlaceSearchCallback } from './map' |
|
|
|
|
import { SearchDownList } from './component/SearchDownListPlugins/SearchDownList'; |
|
|
|
|
import { SearchService } from '@src/app/searchComponent.service'; |
|
|
|
|
import * as ObjectID from 'bson-objectid'; |
|
|
|
@ -154,17 +154,27 @@ export class KeDaMap extends KedaBasic implements IMap {
|
|
|
|
|
}); |
|
|
|
|
return center |
|
|
|
|
} |
|
|
|
|
on(eventName: string, callback: Function): void { |
|
|
|
|
on(eventName: string, callback: EventCallback, component?: any) { |
|
|
|
|
let eventMapProfile = { |
|
|
|
|
complete: "load", |
|
|
|
|
click: "click", |
|
|
|
|
rightclick: "contextmenu" |
|
|
|
|
}; |
|
|
|
|
if (eventName == "click") { |
|
|
|
|
this.self.addEventOnMap({event: "click", |
|
|
|
|
handler: (res)=>{ |
|
|
|
|
console.log(res,'地图点击') |
|
|
|
|
var d:ClickOptions = res.data.map(); |
|
|
|
|
callback.call(component,d); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.self.addEventOnMap({ |
|
|
|
|
event: eventMapProfile[eventName], |
|
|
|
|
handler: callback |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export class KeDaPixel extends KedaBasic implements IPixel { |
|
|
|
@ -237,10 +247,11 @@ export class KeDaMarker extends KedaBasic implements IMarker {
|
|
|
|
|
this.self.id = str |
|
|
|
|
} |
|
|
|
|
public bindObj = []; // event
|
|
|
|
|
on(eventName: string, callback: Function): void { |
|
|
|
|
on(eventName: string, callback: EventCallback, component?: any) { |
|
|
|
|
this.bindObj.push({ |
|
|
|
|
eventName: eventName, |
|
|
|
|
callback: callback, |
|
|
|
|
component: component, |
|
|
|
|
}); |
|
|
|
|
this.startBindEvent(); |
|
|
|
|
} |
|
|
|
@ -250,7 +261,12 @@ export class KeDaMarker extends KedaBasic implements IMarker {
|
|
|
|
|
this.map.self.addEventOnMarkers({ |
|
|
|
|
selector: `.${this.id}`, |
|
|
|
|
event: item.eventName, |
|
|
|
|
handler: item.callback, |
|
|
|
|
handler: (res) =>{ |
|
|
|
|
console.log(res,'marker点击') |
|
|
|
|
var d:ClickOptions = res.data.map(); |
|
|
|
|
d.target.id = this.self.id |
|
|
|
|
item.callback.call(item.component,d) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
this.bindObj = []; |
|
|
|
|