You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
4 years ago
|
import { IMap, IMapOptions, IMarker, IPixel } from './map'
|
||
|
declare var KMap: any;
|
||
|
import $ from 'jquery';
|
||
|
|
||
|
export class KeDaMap implements IMap {
|
||
|
self: any;
|
||
|
constructor(container: string, options: IMapOptions) {
|
||
|
let opt = Object.assign({}, { containerId: container }, options) as any;
|
||
|
opt.configUrl = "";
|
||
|
this.self = new KMap(opt);
|
||
|
}
|
||
|
on(eventName: string, callback: Function): void {
|
||
|
let eventMapProfile = {
|
||
|
complete: "load",
|
||
|
click: "click",
|
||
|
rightclick: "contextmenu"
|
||
|
};
|
||
|
this.self.addEventOnMap({
|
||
|
event: eventMapProfile[eventName],
|
||
|
handler: callback
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export class KeDaPixel implements IPixel {
|
||
|
self: any;
|
||
|
constructor(x: number, y: number) {
|
||
|
this.self = [x, y];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export class KeDaMarker implements IMarker {
|
||
|
self: any;
|
||
|
constructor(options: any) {
|
||
|
let element = $(options.content)[0];
|
||
|
let d = {
|
||
|
offset: options.offset,
|
||
|
element: element
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
this.self = d;
|
||
|
}
|
||
|
}
|