This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
238 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "purescript-leaflet", | ||
"name": "purescript-leafletjs", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var L = require("leaflet"); | ||
|
||
exports.layers_ = function(baseLayers, overlays, options) { | ||
return function() { | ||
return L.control.layers(baseLayers, overlays, options); | ||
}; | ||
}; | ||
|
||
exports.addTo_ = function(map, control) { | ||
return function() { | ||
return control.addTo(map); | ||
}; | ||
}; | ||
|
||
exports.remove_ = function(control) { | ||
return function() { | ||
return control.remove(); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module Leaflet.Core.Control | ||
( layers | ||
, addTo | ||
, remove | ||
) where | ||
|
||
import Prelude | ||
|
||
import Control.Monad.Eff (Eff) | ||
import Control.Monad.Eff.Class (class MonadEff, liftEff) | ||
|
||
import Data.StrMap as SM | ||
import Data.Function.Uncurried (Fn2, runFn2, Fn3, runFn3) | ||
|
||
import DOM (DOM) | ||
|
||
import Leaflet.Core.Types as T | ||
|
||
foreign import layers_ | ||
∷ ∀ e r. Fn3 (SM.StrMap T.Layer) (SM.StrMap T.LayerGroup) r (Eff (dom ∷ DOM|e) T.Control) | ||
|
||
foreign import addTo_ | ||
∷ ∀ e. Fn2 T.Leaflet T.Control (Eff (dom ∷ DOM|e) T.Control) | ||
|
||
foreign import remove_ | ||
∷ ∀ e. T.Control → Eff (dom ∷ DOM|e) Unit | ||
|
||
layers | ||
∷ ∀ m e r1 r2 | ||
. MonadEff (dom ∷ DOM|e) m | ||
⇒ Union r1 r2 (T.LayerControlConf ()) | ||
⇒ SM.StrMap T.Layer | ||
→ SM.StrMap T.LayerGroup | ||
→ Record r1 | ||
→ m T.Control | ||
layers bs os r = | ||
liftEff $ runFn3 layers_ bs os r | ||
|
||
addTo | ||
∷ ∀ m e | ||
. MonadEff (dom ∷ DOM|e) m | ||
⇒ T.Leaflet | ||
→ T.Control | ||
→ m T.Control | ||
addTo leaf control = | ||
liftEff $ runFn2 addTo_ leaf control | ||
|
||
remove | ||
∷ ∀ m e | ||
. MonadEff (dom ∷ DOM|e) m | ||
⇒ T.Control | ||
→ m Unit | ||
remove control = | ||
liftEff $ remove_ control |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.