Browse Source

first commit

master
pvincent 4 years ago
commit
3e92f482ce
  1. 4
      README.md
  2. 14
      haxelib.json
  3. 94
      src/leaflet/L.hx

4
README.md

@ -0,0 +1,4 @@
# hxleaflet
Haxe externs for leaflet js v0.7.7
More infos at http://leafletjs.com/

14
haxelib.json

@ -0,0 +1,14 @@
{
"name": "hxleaflet",
"url" : "https://github.com/bablukid/hxleaflet/",
"license": "GNU GPL",
"classPath": "src",
"tags": ["web", "javascript","maps"],
"description": "haxe port of Leaflet js",
"version": "1.0.0",
"releasenote": "",
"contributors": ["bablukid"],
"dependencies": {
}
}

94
src/leaflet/L.hx

@ -0,0 +1,94 @@
package leaflet;
/**
* Leaflet.js externs for Leaftlet 0.7.7
*
* @doc http://leafletjs.com/reference.html
* @doc https://github.com/Leaflet/Leaflet
*
*
* @author fbarbut<francois.barbut@gmail.com>
*/
@:jsRequire('leaflet')
extern class L
{
public static function map(elementId:String,?options:MapOptions):LeafletMap;
public static function icon(options:IconOptions):Icon;
public static function latLng(lat:Float, lng:Float):Dynamic;
public static function marker(coords:Array<Float>, options:{ icon:Icon } ):Marker;
public static function tileLayer(tileUrl:String, options: TileLayerOptions ):TileLayer;
}
@:native("L.Map")
extern class LeafletMap
{
public function setView(coords: Array<Float>, zoomLevel:Int):LeafletMap;
public function addLayer(layer:Dynamic):LeafletMap; //can be any ILayer : marker, tileLayer ... http://leafletjs.com/reference.html#ilayer
public function removeLayer(layer:Dynamic):LeafletMap;
public function on(event:String, callback:Dynamic->Void):Void;
public function getBounds():LatLngBounds;
}
@:native("L.LatLngBounds")
extern class LatLngBounds {
public function getSouthWest():LatLng;
public function getNorthEast():LatLng;
}
@:native("L.LatLng")
extern class LatLng {
public var lat:Float;
public var lng:Float;
}
@:native("L.TileLayer")
extern class TileLayer {
public function new(tileUrl:String, options: TileLayerOptions );
public function addTo(map:LeafletMap):TileLayer;
}
@:native("L.Icon")
extern class Icon {
}
@:native("L.Marker")
extern class Marker extends js.html.EventTarget{
public function bindPopup(html:String ):Marker;
public function addTo(map:LeafletMap):Marker;
}
typedef TileLayerOptions = {
?minZoom:Int,
?maxZoom:Int,
?attribution:String,
?accessToken:String,
?id:String,
?zoomControl: Bool
}
typedef MapOptions = {
?scrollWheelZoom:Bool,
?zoomControl:Bool
}
typedef IconOptions = {
iconUrl:String,
?iconRetinaUrl:String,
?iconSize:Array<Int>,
?iconAnchor:Array<Int>,
?popupAnchor:Array<Int>,
?shadowUrl:String,
?shadowRetinaUrl:String,
?shadowSize: Array<Int>,
?shadowAnchor:Array<Int>,
?className:String
}
Loading…
Cancel
Save