leaflet-js 0.6.beta4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +6 -14
- data/CHANGELOG.rdoc +3 -0
- data/leaflet-js.gemspec +2 -2
- data/lib/leaflet.draw/CHANGELOG.md +45 -0
- data/lib/leaflet.draw/README.md +70 -23
- data/lib/leaflet.draw/build/deps.js +1 -0
- data/lib/leaflet.draw/dist/images/spritesheet-2x.png +0 -0
- data/lib/leaflet.draw/dist/images/spritesheet.png +0 -0
- data/lib/leaflet.draw/dist/leaflet.draw-src.js +489 -136
- data/lib/leaflet.draw/dist/leaflet.draw.css +34 -2
- data/lib/leaflet.draw/dist/leaflet.draw.ie.css +5 -0
- data/lib/leaflet.draw/dist/leaflet.draw.js +2 -2
- data/lib/leaflet.draw/examples/basic.html +14 -7
- data/lib/leaflet.draw/examples/libs/images/layers-2x.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/layers.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/marker-icon-2x.png +0 -0
- data/lib/leaflet.draw/examples/libs/leaflet-src.js +1129 -608
- data/lib/leaflet.draw/examples/libs/leaflet.css +85 -66
- data/lib/leaflet.draw/package.json +2 -2
- data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +1 -1
- data/lib/leaflet.draw/spec/suites/GeometryUtilSpec.js +25 -0
- data/lib/leaflet.draw/spec/suites/LatLngUtilSpec.js +9 -0
- data/lib/leaflet.draw/src/Control.Draw.js +1 -0
- data/lib/leaflet.draw/src/Leaflet.draw.js +89 -1
- data/lib/leaflet.draw/src/Toolbar.js +2 -6
- data/lib/leaflet.draw/src/Tooltip.js +20 -7
- data/lib/leaflet.draw/src/draw/DrawToolbar.js +26 -22
- data/lib/leaflet.draw/src/draw/handler/Draw.Circle.js +11 -6
- data/lib/leaflet.draw/src/draw/handler/Draw.Feature.js +6 -2
- data/lib/leaflet.draw/src/draw/handler/Draw.Marker.js +7 -2
- data/lib/leaflet.draw/src/draw/handler/Draw.Polygon.js +29 -7
- data/lib/leaflet.draw/src/draw/handler/Draw.Polyline.js +44 -21
- data/lib/leaflet.draw/src/draw/handler/Draw.Rectangle.js +3 -3
- data/lib/leaflet.draw/src/draw/handler/Draw.SimpleShape.js +14 -1
- data/lib/leaflet.draw/src/edit/EditToolbar.js +86 -16
- data/lib/leaflet.draw/src/edit/handler/Edit.Poly.js +10 -7
- data/lib/leaflet.draw/src/edit/handler/Edit.SimpleShape.js +1 -2
- data/lib/leaflet.draw/src/edit/handler/EditToolbar.Delete.js +15 -3
- data/lib/leaflet.draw/src/edit/handler/EditToolbar.Edit.js +56 -38
- data/lib/leaflet.draw/src/ext/GeometryUtil.js +68 -0
- data/lib/leaflet.draw/src/images/spritesheet.svg +41 -0
- data/lib/leaflet.label/CHANGELOG.md +32 -0
- data/lib/leaflet.label/README.md +21 -4
- data/lib/leaflet.label/build/build.js +2 -2
- data/lib/leaflet.label/build/deps.js +2 -0
- data/lib/leaflet.label/build/hintrc.js +4 -0
- data/lib/leaflet.label/dist/leaflet.label-src.js +266 -83
- data/lib/leaflet.label/dist/leaflet.label.css +23 -4
- data/lib/leaflet.label/dist/leaflet.label.js +1 -1
- data/lib/leaflet.label/example/label.html +6 -3
- data/lib/leaflet.label/libs/leaflet/images/layers-2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/layers.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon-2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/leaflet-src.js +1129 -608
- data/lib/leaflet.label/libs/leaflet/leaflet.css +85 -66
- data/lib/leaflet.label/libs/leaflet/leaflet.js +6 -5
- data/lib/leaflet.label/package.json +19 -0
- data/lib/leaflet.label/src/BaseMarkerMethods.js +129 -0
- data/lib/leaflet.label/src/CircleMarker.Label.js +7 -0
- data/lib/leaflet.label/src/Label.js +161 -37
- data/lib/leaflet.label/src/Leaflet.label.js +1 -1
- data/lib/leaflet.label/src/Map.Label.js +0 -2
- data/lib/leaflet.label/src/Marker.Label.js +15 -120
- data/lib/leaflet.label/src/Path.Label.js +11 -11
- data/lib/leaflet/CHANGELOG.md +299 -31
- data/lib/leaflet/CONTRIBUTING.md +3 -3
- data/lib/leaflet/FAQ.md +138 -0
- data/lib/leaflet/Jakefile.js +24 -4
- data/lib/leaflet/PLUGIN-GUIDE.md +127 -0
- data/lib/leaflet/README.md +10 -6
- data/lib/leaflet/build/build.html +3 -19
- data/lib/leaflet/build/build.js +21 -51
- data/lib/leaflet/build/deps.js +10 -7
- data/lib/leaflet/build/hintrc.js +6 -4
- data/lib/leaflet/debug/hacks/jitter.html +0 -1
- data/lib/leaflet/debug/map/canvas.html +11 -12
- data/lib/leaflet/debug/map/controls.html +3 -4
- data/lib/leaflet/debug/map/geolocation.html +0 -1
- data/lib/leaflet/debug/map/iframe.html +11 -0
- data/lib/leaflet/debug/map/image-overlay.html +0 -1
- data/lib/leaflet/debug/map/map-mobile.html +0 -1
- data/lib/leaflet/debug/map/map.html +1 -2
- data/lib/leaflet/debug/map/max-bounds.html +2 -1
- data/lib/leaflet/debug/map/opacity.html +223 -0
- data/lib/leaflet/debug/map/scroll.html +6 -1
- data/lib/leaflet/debug/map/simple-proj.html +0 -1
- data/lib/leaflet/debug/map/wms-marble.html +4 -5
- data/lib/leaflet/debug/map/wms.html +0 -1
- data/lib/leaflet/debug/map/zoomlevels.html +0 -1
- data/lib/leaflet/debug/tests/add_remove_layers.html +5 -6
- data/lib/leaflet/debug/tests/bringtoback.html +0 -1
- data/lib/leaflet/debug/tests/canvasloop.html +47 -0
- data/lib/leaflet/debug/tests/click_on_canvas.html +0 -1
- data/lib/leaflet/debug/tests/dragging_and_copyworldjump.html +61 -0
- data/lib/leaflet/debug/tests/opacity.html +0 -1
- data/lib/leaflet/debug/tests/popupcontextmenuclicks.html +59 -0
- data/lib/leaflet/debug/tests/remove_while_dragging.html +4 -5
- data/lib/leaflet/debug/tests/removetilewhilepan.html +0 -1
- data/lib/leaflet/debug/tests/reuse_popups.html +0 -1
- data/lib/leaflet/debug/tests/rtl.html +42 -0
- data/lib/leaflet/debug/tests/rtl2.html +27 -0
- data/lib/leaflet/debug/tests/set_icon_reuse_dom.html +43 -0
- data/lib/leaflet/debug/tests/svg_clicks.html +3 -4
- data/lib/leaflet/debug/vector/bounds-extend.html +0 -1
- data/lib/leaflet/debug/vector/feature-group-bounds.html +0 -1
- data/lib/leaflet/debug/vector/geojson.html +0 -1
- data/lib/leaflet/debug/vector/rectangle.html +0 -1
- data/lib/leaflet/debug/vector/touchzoomemu.html +2 -3
- data/lib/leaflet/debug/vector/vector-bounds.html +0 -1
- data/lib/leaflet/debug/vector/vector-canvas.html +0 -1
- data/lib/leaflet/debug/vector/vector-mobile.html +0 -1
- data/lib/leaflet/debug/vector/vector-simple.html +0 -1
- data/lib/leaflet/debug/vector/vector.html +0 -1
- data/lib/leaflet/dist/images/layers-2x.png +0 -0
- data/lib/leaflet/dist/images/layers.png +0 -0
- data/lib/leaflet/dist/leaflet.css +85 -66
- data/lib/leaflet/package.json +25 -20
- data/lib/leaflet/spec/after.js +1 -1
- data/lib/leaflet/spec/index.html +21 -13
- data/lib/leaflet/spec/karma.conf.js +51 -50
- data/lib/leaflet/spec/spec.hintrc.js +25 -0
- data/lib/leaflet/spec/suites/LeafletSpec.js +2 -2
- data/lib/leaflet/spec/suites/SpecHelper.js +37 -21
- data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +1 -1
- data/lib/leaflet/spec/suites/core/ClassSpec.js +12 -12
- data/lib/leaflet/spec/suites/core/EventsSpec.js +74 -18
- data/lib/leaflet/spec/suites/core/UtilSpec.js +69 -25
- data/lib/leaflet/spec/suites/dom/DomEventSpec.js +16 -16
- data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +9 -16
- data/lib/leaflet/spec/suites/dom/PosAnimationSpec.js +27 -0
- data/lib/leaflet/spec/suites/geo/CRSSpec.js +47 -0
- data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +22 -14
- data/lib/leaflet/spec/suites/geo/LatLngSpec.js +22 -8
- data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +21 -20
- data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +15 -15
- data/lib/leaflet/spec/suites/geometry/PointSpec.js +12 -12
- data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +4 -4
- data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +59 -9
- data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +213 -17
- data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +6 -6
- data/lib/leaflet/spec/suites/layer/PopupSpec.js +65 -5
- data/lib/leaflet/spec/suites/layer/TileLayerSpec.js +16 -15
- data/lib/leaflet/spec/suites/layer/marker/MarkerSpec.js +94 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +7 -7
- data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +38 -2
- data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +4 -4
- data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +2 -2
- data/lib/leaflet/spec/suites/map/MapSpec.js +318 -26
- data/lib/leaflet/spec/suites/map/handler/Map.DragSpec.js +38 -0
- data/lib/leaflet/src/Leaflet.js +2 -2
- data/lib/leaflet/src/control/Control.Attribution.js +6 -0
- data/lib/leaflet/src/control/Control.Layers.js +33 -24
- data/lib/leaflet/src/control/Control.Zoom.js +12 -4
- data/lib/leaflet/src/control/Control.js +10 -0
- data/lib/leaflet/src/copyright.js +2 -1
- data/lib/leaflet/src/core/Browser.js +11 -10
- data/lib/leaflet/src/core/Events.js +15 -11
- data/lib/leaflet/src/core/Util.js +19 -14
- data/lib/leaflet/src/dom/DomEvent.DoubleTap.js +13 -12
- data/lib/leaflet/src/dom/DomEvent.Pointer.js +155 -0
- data/lib/leaflet/src/dom/DomEvent.js +57 -19
- data/lib/leaflet/src/dom/DomUtil.js +89 -34
- data/lib/leaflet/src/dom/Draggable.js +26 -89
- data/lib/leaflet/src/dom/PosAnimation.js +13 -2
- data/lib/leaflet/src/geo/LatLng.js +16 -5
- data/lib/leaflet/src/geo/LatLngBounds.js +5 -2
- data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +2 -2
- data/lib/leaflet/src/geo/crs/CRS.js +5 -0
- data/lib/leaflet/src/geo/projection/Projection.Mercator.js +3 -3
- data/lib/leaflet/src/geometry/LineUtil.js +2 -2
- data/lib/leaflet/src/images/layers.svg +8 -0
- data/lib/leaflet/src/images/marker.svg +61 -1
- data/lib/leaflet/src/layer/FeatureGroup.js +24 -7
- data/lib/leaflet/src/layer/GeoJSON.js +97 -56
- data/lib/leaflet/src/layer/ImageOverlay.js +9 -0
- data/lib/leaflet/src/layer/LayerGroup.js +8 -3
- data/lib/leaflet/src/layer/Popup.js +56 -34
- data/lib/leaflet/src/layer/marker/DivIcon.js +4 -2
- data/lib/leaflet/src/layer/marker/Icon.Default.js +1 -1
- data/lib/leaflet/src/layer/marker/Icon.js +15 -18
- data/lib/leaflet/src/layer/marker/Marker.Drag.js +7 -5
- data/lib/leaflet/src/layer/marker/Marker.Popup.js +22 -5
- data/lib/leaflet/src/layer/marker/Marker.js +75 -32
- data/lib/leaflet/src/layer/tile/TileLayer.Anim.js +14 -26
- data/lib/leaflet/src/layer/tile/TileLayer.Canvas.js +7 -6
- data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +14 -10
- data/lib/leaflet/src/layer/tile/TileLayer.js +53 -32
- data/lib/leaflet/src/layer/vector/CircleMarker.js +11 -0
- data/lib/leaflet/src/layer/vector/MultiPoly.js +10 -0
- data/lib/leaflet/src/layer/vector/Path.SVG.js +14 -3
- data/lib/leaflet/src/layer/vector/Path.VML.js +12 -2
- data/lib/leaflet/src/layer/vector/Path.js +7 -3
- data/lib/leaflet/src/layer/vector/Polygon.js +14 -3
- data/lib/leaflet/src/layer/vector/canvas/CircleMarker.Canvas.js +9 -0
- data/lib/leaflet/src/layer/vector/canvas/Path.Canvas.js +1 -0
- data/lib/leaflet/src/map/Map.js +192 -125
- data/lib/leaflet/src/map/anim/Map.PanAnimation.js +29 -19
- data/lib/leaflet/src/map/anim/Map.ZoomAnimation.js +21 -9
- data/lib/leaflet/src/map/ext/Map.Geolocation.js +11 -4
- data/lib/leaflet/src/map/handler/Map.BoxZoom.js +26 -12
- data/lib/leaflet/src/map/handler/Map.DoubleClickZoom.js +10 -3
- data/lib/leaflet/src/map/handler/Map.Drag.js +12 -6
- data/lib/leaflet/src/map/handler/Map.Keyboard.js +5 -2
- data/lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js +7 -1
- data/lib/leaflet/src/map/handler/Map.Tap.js +107 -0
- data/lib/leaflet/src/map/handler/Map.TouchZoom.js +9 -3
- data/vendor/assets/images/layers-2x.png +0 -0
- data/vendor/assets/images/layers.png +0 -0
- data/vendor/assets/images/spritesheet-2x.png +0 -0
- data/vendor/assets/images/spritesheet.png +0 -0
- data/vendor/assets/javascripts/leaflet.draw.js +2 -4
- data/vendor/assets/javascripts/leaflet.js +3 -1
- data/vendor/assets/javascripts/leaflet.label.js +2 -0
- data/vendor/assets/stylesheets/leaflet.css.erb +337 -318
- data/vendor/assets/stylesheets/leaflet.draw.css.erb +35 -3
- data/vendor/assets/stylesheets/leaflet.draw.ie.css +5 -0
- data/vendor/assets/stylesheets/leaflet.label.css +23 -4
- metadata +40 -14
- data/lib/leaflet.draw/examples/libs/leaflet.ie.css +0 -51
- data/lib/leaflet.label/libs/leaflet/leaflet.ie.css +0 -51
- data/lib/leaflet/dist/leaflet-src.js +0 -8579
- data/lib/leaflet/dist/leaflet.ie.css +0 -51
- data/lib/leaflet/dist/leaflet.js +0 -8
- data/lib/leaflet/spec/happen.js +0 -93
- data/lib/leaflet/src/dom/DomEvent.MsTouch.js +0 -146
- data/vendor/assets/stylesheets/leaflet.ie.css +0 -51
data/lib/leaflet/Jakefile.js
CHANGED
|
@@ -14,13 +14,33 @@ For a custom build, open build/build.html in the browser and follow the instruct
|
|
|
14
14
|
|
|
15
15
|
var build = require('./build/build.js');
|
|
16
16
|
|
|
17
|
+
function hint(msg, paths) {
|
|
18
|
+
return function () {
|
|
19
|
+
console.log(msg);
|
|
20
|
+
jake.exec('node node_modules/jshint/bin/jshint -c ' + paths,
|
|
21
|
+
{printStdout: true}, function () {
|
|
22
|
+
console.log('\tCheck passed.\n');
|
|
23
|
+
complete();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
17
28
|
desc('Check Leaflet source for errors with JSHint');
|
|
18
|
-
task('lint', build.
|
|
29
|
+
task('lint', {async: true}, hint('Checking for JS errors...', 'build/hintrc.js src'));
|
|
30
|
+
|
|
31
|
+
desc('Check Leaflet specs source for errors with JSHint');
|
|
32
|
+
task('lintspec', {async: true}, hint('Checking for specs JS errors...', 'spec/spec.hintrc.js spec/suites'));
|
|
19
33
|
|
|
20
34
|
desc('Combine and compress Leaflet source files');
|
|
21
|
-
task('build',
|
|
35
|
+
task('build', build.build);
|
|
22
36
|
|
|
23
37
|
desc('Run PhantomJS tests');
|
|
24
|
-
task('test', ['lint'],
|
|
38
|
+
task('test', ['lint', 'lintspec'], {async: true}, function () {
|
|
39
|
+
build.test(complete);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
task('default', ['test', 'build']);
|
|
25
43
|
|
|
26
|
-
|
|
44
|
+
jake.addListener('complete', function () {
|
|
45
|
+
process.exit();
|
|
46
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Leaflet Plugin Authoring Guide
|
|
2
|
+
|
|
3
|
+
One of the greatest things about Leaflet is its powerful plugin ecosystem.
|
|
4
|
+
The [Leaflet plugins page](http://leafletjs.com/plugins.html) lists dozens of awesome plugins, and more are being added every week.
|
|
5
|
+
|
|
6
|
+
This guide lists a number of best practices for publishing a Leaflet plugin that meets the quality standards of Leaflet itself.
|
|
7
|
+
|
|
8
|
+
1. [Presentation](#presentation)
|
|
9
|
+
- [Repository](#repository)
|
|
10
|
+
- [Name](#name)
|
|
11
|
+
- [Demo](#demo)
|
|
12
|
+
- [Readme](#readme)
|
|
13
|
+
- [License](#license)
|
|
14
|
+
2. [Code](#code)
|
|
15
|
+
- [File Structure](#file-structure)
|
|
16
|
+
- [Code Conventions](#code-conventions)
|
|
17
|
+
- [Plugin API](#plugin-api)
|
|
18
|
+
|
|
19
|
+
## Presentation
|
|
20
|
+
|
|
21
|
+
### Repository
|
|
22
|
+
|
|
23
|
+
The best place to put your Leaflet plugin to is a separate [GitHub](http://github.com) repository.
|
|
24
|
+
If you create a collection of plugins for different uses,
|
|
25
|
+
don't put them in one repo —
|
|
26
|
+
it's usually easier to work with small, self-contained plugins in individual repositories.
|
|
27
|
+
|
|
28
|
+
### Name
|
|
29
|
+
|
|
30
|
+
Most existing plugins follow the convention of naming plugins (and repos) like this: `Leaflet.MyPluginName`.
|
|
31
|
+
You can use other forms (e.g. "leaflet-my-plugin-name"),
|
|
32
|
+
just make sure to include the word "Leaflet" in the name so that it's obvious that it's a Leaflet plugin.
|
|
33
|
+
|
|
34
|
+
### Demo
|
|
35
|
+
|
|
36
|
+
The most essential thing to do when publishing a plugin is to include a demo that showcases what the plugin does —
|
|
37
|
+
it's usually the first thing people will look for.
|
|
38
|
+
|
|
39
|
+
The easiest way to put up a demo is using [GitHub Pages](http://pages.github.com/).
|
|
40
|
+
A good [starting point](https://help.github.com/articles/creating-project-pages-manually) is creating a `gh-pages` branch in your repo and adding an `index.html` page to it —
|
|
41
|
+
after pushing, it'll be published as `http://<user>.github.io/<repo>`.
|
|
42
|
+
|
|
43
|
+
### Readme
|
|
44
|
+
|
|
45
|
+
The next thing you need to have is a descriptive `README.md` in the root of the repo (or a link to a website with a similar content).
|
|
46
|
+
At a minimum it should contain the following items:
|
|
47
|
+
|
|
48
|
+
- name of the plugin
|
|
49
|
+
- a simple, concise description of what it does
|
|
50
|
+
- requirements
|
|
51
|
+
- Leaflet version
|
|
52
|
+
- other external dependencies (if any)
|
|
53
|
+
- browser / device compatibility
|
|
54
|
+
- links to demos
|
|
55
|
+
- instructions for including the plugin
|
|
56
|
+
- simple usage code example
|
|
57
|
+
- API reference (methods, options, events)
|
|
58
|
+
|
|
59
|
+
### License
|
|
60
|
+
|
|
61
|
+
Every open source repository should include a license.
|
|
62
|
+
If you don't know what open source license to choose for your code,
|
|
63
|
+
[MIT License](http://opensource.org/licenses/MIT) and [BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause) are both good choices.
|
|
64
|
+
You can either put it in the repo as a `LICENSE` file or just link to the license from the Readme.
|
|
65
|
+
|
|
66
|
+
## Code
|
|
67
|
+
|
|
68
|
+
### File Structure
|
|
69
|
+
|
|
70
|
+
Keep the file structure clean and simple,
|
|
71
|
+
don't pile up lots of files in one place —
|
|
72
|
+
make it easy for a new person to find their way in your repo.
|
|
73
|
+
|
|
74
|
+
A barebones repo for a simple plugin would look like this:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
my-plugin.js
|
|
78
|
+
README.md
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
An example of a more sophisticated plugin file structure:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
/src - JS source files
|
|
85
|
+
/dist - minified plugin JS, CSS, images
|
|
86
|
+
/spec - test files
|
|
87
|
+
/lib - any external libraries/plugins if necessary
|
|
88
|
+
/examples - HTML examples of plugin usage
|
|
89
|
+
README.md
|
|
90
|
+
LICENSE
|
|
91
|
+
package.json
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Code Conventions
|
|
95
|
+
|
|
96
|
+
Everyone's tastes are different, but it's important to be consistent with whatever conventions you choose for your plugin.
|
|
97
|
+
|
|
98
|
+
For a good starting point, check out [Airbnb JavaScript Guide](https://github.com/airbnb/javascript).
|
|
99
|
+
Leaflet follows pretty much the same conventions
|
|
100
|
+
except for using smart tabs (hard tabs for indentation, spaces for alignment)
|
|
101
|
+
and putting a space after the `function` keyword.
|
|
102
|
+
|
|
103
|
+
### Plugin API
|
|
104
|
+
|
|
105
|
+
Never expose global variables in your plugin.<br>
|
|
106
|
+
If you have a new class, put it directly in the `L` namespace (`L.MyPlugin`).<br>
|
|
107
|
+
If you inherit one of the existing classes, make it a sub-property (`L.TileLayer.Banana`).<br>
|
|
108
|
+
If you want to add new methods to existing Leaflet classes, you can do it like this: `L.Marker.include({myPlugin: …})`.
|
|
109
|
+
|
|
110
|
+
Function, method and property names should be in `camelCase`.<br>
|
|
111
|
+
Class names should be in `CapitalizedCamelCase`.
|
|
112
|
+
|
|
113
|
+
If you have a lot of arguments in your function, consider accepting an options object instead
|
|
114
|
+
(putting default values where possible so that users don't need specify all of them):
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
// bad
|
|
118
|
+
marker.myPlugin('bla', 'foo', null, {}, 5, 0);
|
|
119
|
+
|
|
120
|
+
// good
|
|
121
|
+
marker.myPlugin('bla', {
|
|
122
|
+
optionOne: 'foo',
|
|
123
|
+
optionThree: 5
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
And most importantly, keep it simple. Leaflet is all about *simplicity*.
|
data/lib/leaflet/README.md
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
<img src="http://leafletjs.com/docs/images/logo.png" alt="Leaflet" />
|
|
2
2
|
|
|
3
|
-
Leaflet is
|
|
4
|
-
It is developed by [Vladimir Agafonkin][] with a team of dedicated [contributors][].
|
|
5
|
-
Weighing just about
|
|
3
|
+
Leaflet is an open source JavaScript library for **mobile-friendly interactive maps**.
|
|
4
|
+
It is developed by [Vladimir Agafonkin][] of [MapBox][] with a team of dedicated [contributors][].
|
|
5
|
+
Weighing just about 30 KB of gzipped JS code, it has all the [features][] most developers ever need for online maps.
|
|
6
6
|
|
|
7
7
|
Leaflet is designed with *simplicity*, *performance* and *usability* in mind.
|
|
8
8
|
It works efficiently across all major desktop and mobile platforms out of the box,
|
|
9
9
|
taking advantage of HTML5 and CSS3 on modern browsers while being accessible on older ones too.
|
|
10
|
-
It can
|
|
10
|
+
It can be extended with a huge amount of [plugins][],
|
|
11
11
|
has a beautiful, easy to use and [well-documented][] API
|
|
12
12
|
and a simple, readable [source code][] that is a joy to [contribute][] to.
|
|
13
13
|
|
|
14
|
-
For more
|
|
14
|
+
For more info, docs and tutorials, check out the [official website][].<br>
|
|
15
|
+
For **Leaflet downloads** (including the built master version), check out the [download page][].
|
|
15
16
|
|
|
16
17
|
We're happy to meet new contributors.
|
|
17
18
|
If you want to **get involved** with Leaflet development, check out the [contribution guide][contribute].
|
|
18
|
-
Let's make the best
|
|
19
|
+
Let's make the best mapping library that will ever exist,
|
|
20
|
+
and push the limits of what's possible with online maps!
|
|
19
21
|
|
|
20
22
|
[](https://travis-ci.org/Leaflet/Leaflet)
|
|
21
23
|
|
|
@@ -28,3 +30,5 @@ Let's make the best open-source library for maps that can possibly exist!
|
|
|
28
30
|
[hosted on GitHub]: http://github.com/Leaflet/Leaflet
|
|
29
31
|
[contribute]: https://github.com/Leaflet/Leaflet/blob/master/CONTRIBUTING.md "A guide to contributing to Leaflet"
|
|
30
32
|
[official website]: http://leafletjs.com
|
|
33
|
+
[download page]: http://leafletjs.com/download.html
|
|
34
|
+
[MapBox]: https://mapbox.com
|
|
@@ -86,21 +86,14 @@
|
|
|
86
86
|
<li><a href="http://nodejs.org/#download">Download and install Node</a></li>
|
|
87
87
|
<li>Run this in the command line:<br />
|
|
88
88
|
<pre><code>npm install -g jake
|
|
89
|
-
npm install
|
|
90
|
-
npm install uglify-js</code></pre></li>
|
|
89
|
+
npm install</code></pre></li>
|
|
91
90
|
<li>Run this command inside the Leaflet directory: <br /><input type="text" id="command2" />
|
|
92
91
|
</ol>
|
|
93
|
-
<h2>Building using Closure Compiler</h2>
|
|
94
|
-
<ol>
|
|
95
|
-
<li><a href="http://closure-compiler.googlecode.com/files/compiler-latest.zip">Download Closure Compiler</a>, extract it into <code>closure-compiler</code> directory</li>
|
|
96
|
-
<li>Run this command in the root Leaflet directory: <br /><input type="text" id="command" /></li>
|
|
97
|
-
</ol>
|
|
98
92
|
</div>
|
|
99
93
|
|
|
100
94
|
<script type="text/javascript">
|
|
101
95
|
var deplist = document.getElementById('deplist'),
|
|
102
|
-
commandInput = document.getElementById('
|
|
103
|
-
commandInput2 = document.getElementById('command2');
|
|
96
|
+
commandInput = document.getElementById('command2');
|
|
104
97
|
|
|
105
98
|
document.getElementById('select-all').onclick = function() {
|
|
106
99
|
var checks = deplist.getElementsByTagName('input');
|
|
@@ -139,15 +132,7 @@ npm install uglify-js</code></pre></li>
|
|
|
139
132
|
}
|
|
140
133
|
}
|
|
141
134
|
|
|
142
|
-
|
|
143
|
-
for (var src in files) {
|
|
144
|
-
command += '--js src/' + src + ' ';
|
|
145
|
-
}
|
|
146
|
-
command += '--js_output_file dist/leaflet-custom.js';
|
|
147
|
-
|
|
148
|
-
commandInput.value = command;
|
|
149
|
-
|
|
150
|
-
commandInput2.value = 'jake build[' + parseInt(compsStr, 2).toString(32) + ',custom]';
|
|
135
|
+
commandInput.value = 'jake build[' + parseInt(compsStr, 2).toString(32) + ',custom]';
|
|
151
136
|
}
|
|
152
137
|
|
|
153
138
|
function inputSelect() {
|
|
@@ -156,7 +141,6 @@ npm install uglify-js</code></pre></li>
|
|
|
156
141
|
};
|
|
157
142
|
|
|
158
143
|
commandInput.onclick = inputSelect;
|
|
159
|
-
commandInput2.onclick = inputSelect;
|
|
160
144
|
|
|
161
145
|
function onCheckboxChange() {
|
|
162
146
|
if (this.checked) {
|
data/lib/leaflet/build/build.js
CHANGED
|
@@ -2,29 +2,7 @@ var fs = require('fs'),
|
|
|
2
2
|
jshint = require('jshint'),
|
|
3
3
|
UglifyJS = require('uglify-js'),
|
|
4
4
|
|
|
5
|
-
deps = require('./deps.js').deps
|
|
6
|
-
hintrc = require('./hintrc.js').config;
|
|
7
|
-
|
|
8
|
-
function lintFiles(files) {
|
|
9
|
-
|
|
10
|
-
var errorsFound = 0,
|
|
11
|
-
i, j, len, len2, src, errors, e;
|
|
12
|
-
|
|
13
|
-
for (i = 0, len = files.length; i < len; i++) {
|
|
14
|
-
|
|
15
|
-
jshint.JSHINT(fs.readFileSync(files[i], 'utf8'), hintrc, i ? {L: true} : null);
|
|
16
|
-
errors = jshint.JSHINT.errors;
|
|
17
|
-
|
|
18
|
-
for (j = 0, len2 = errors.length; j < len2; j++) {
|
|
19
|
-
e = errors[j];
|
|
20
|
-
console.log(files[i] + '\tline ' + e.line + '\tcol ' + e.character + '\t ' + e.reason);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
errorsFound += len2;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return errorsFound;
|
|
27
|
-
}
|
|
5
|
+
deps = require('./deps.js').deps;
|
|
28
6
|
|
|
29
7
|
function getFiles(compsBase32) {
|
|
30
8
|
var memo = {},
|
|
@@ -44,16 +22,18 @@ function getFiles(compsBase32) {
|
|
|
44
22
|
for (var i in deps) {
|
|
45
23
|
if (comps) {
|
|
46
24
|
if (parseInt(comps.pop(), 2) === 1) {
|
|
47
|
-
console.log('
|
|
25
|
+
console.log(' * ' + i);
|
|
48
26
|
addFiles(deps[i].src);
|
|
49
27
|
} else {
|
|
50
|
-
console.log('
|
|
28
|
+
console.log(' ' + i);
|
|
51
29
|
}
|
|
52
30
|
} else {
|
|
53
31
|
addFiles(deps[i].src);
|
|
54
32
|
}
|
|
55
33
|
}
|
|
56
34
|
|
|
35
|
+
console.log('');
|
|
36
|
+
|
|
57
37
|
var files = [];
|
|
58
38
|
|
|
59
39
|
for (var src in memo) {
|
|
@@ -65,23 +45,6 @@ function getFiles(compsBase32) {
|
|
|
65
45
|
|
|
66
46
|
exports.getFiles = getFiles;
|
|
67
47
|
|
|
68
|
-
exports.lint = function () {
|
|
69
|
-
|
|
70
|
-
var files = getFiles();
|
|
71
|
-
|
|
72
|
-
console.log('Checking for JS errors...');
|
|
73
|
-
|
|
74
|
-
var errorsFound = lintFiles(files);
|
|
75
|
-
|
|
76
|
-
if (errorsFound > 0) {
|
|
77
|
-
console.log(errorsFound + ' error(s) found.\n');
|
|
78
|
-
fail();
|
|
79
|
-
} else {
|
|
80
|
-
console.log('\tCheck passed');
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
|
|
85
48
|
function getSizeDelta(newContent, oldContent) {
|
|
86
49
|
if (!oldContent) {
|
|
87
50
|
return 'new';
|
|
@@ -129,10 +92,10 @@ exports.build = function (compsBase32, buildName) {
|
|
|
129
92
|
console.log('\tUncompressed size: ' + newSrc.length + ' bytes (' + srcDelta + ')');
|
|
130
93
|
|
|
131
94
|
if (newSrc === oldSrc) {
|
|
132
|
-
console.log('\tNo changes');
|
|
95
|
+
console.log('\tNo changes\n');
|
|
133
96
|
} else {
|
|
134
97
|
fs.writeFileSync(srcPath, newSrc);
|
|
135
|
-
console.log('\tSaved to ' + srcPath);
|
|
98
|
+
console.log('\tSaved to ' + srcPath + '\n');
|
|
136
99
|
}
|
|
137
100
|
|
|
138
101
|
console.log('Compressing...');
|
|
@@ -148,19 +111,23 @@ exports.build = function (compsBase32, buildName) {
|
|
|
148
111
|
console.log('\tCompressed size: ' + newCompressed.length + ' bytes (' + delta + ')');
|
|
149
112
|
|
|
150
113
|
if (newCompressed === oldCompressed) {
|
|
151
|
-
console.log('\tNo changes');
|
|
114
|
+
console.log('\tNo changes\n');
|
|
152
115
|
} else {
|
|
153
116
|
fs.writeFileSync(path, newCompressed);
|
|
154
|
-
console.log('\tSaved to ' + path);
|
|
117
|
+
console.log('\tSaved to ' + path + '\n');
|
|
155
118
|
}
|
|
156
119
|
};
|
|
157
120
|
|
|
158
|
-
exports.test = function() {
|
|
121
|
+
exports.test = function(callback) {
|
|
159
122
|
var karma = require('karma'),
|
|
160
123
|
testConfig = {configFile : __dirname + '/../spec/karma.conf.js'};
|
|
161
124
|
|
|
162
125
|
testConfig.browsers = ['PhantomJS'];
|
|
163
126
|
|
|
127
|
+
function isArgv(optName) {
|
|
128
|
+
return process.argv.indexOf(optName) !== -1;
|
|
129
|
+
}
|
|
130
|
+
|
|
164
131
|
if (isArgv('--chrome')) {
|
|
165
132
|
testConfig.browsers.push('Chrome');
|
|
166
133
|
}
|
|
@@ -185,9 +152,12 @@ exports.test = function() {
|
|
|
185
152
|
testConfig.reporters = ['coverage'];
|
|
186
153
|
}
|
|
187
154
|
|
|
188
|
-
|
|
155
|
+
console.log('Running tests...');
|
|
189
156
|
|
|
190
|
-
function
|
|
191
|
-
|
|
192
|
-
|
|
157
|
+
karma.server.start(testConfig, function(exitCode) {
|
|
158
|
+
if (!exitCode) {
|
|
159
|
+
console.log('\tTests ran successfully.\n');
|
|
160
|
+
}
|
|
161
|
+
callback();
|
|
162
|
+
});
|
|
193
163
|
};
|
data/lib/leaflet/build/deps.js
CHANGED
|
@@ -143,14 +143,15 @@ var deps = {
|
|
|
143
143
|
VectorsCanvas: {
|
|
144
144
|
src: ['layer/vector/canvas/Polyline.Canvas.js',
|
|
145
145
|
'layer/vector/canvas/Polygon.Canvas.js',
|
|
146
|
-
'layer/vector/canvas/Circle.Canvas.js'
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
'layer/vector/canvas/Circle.Canvas.js',
|
|
147
|
+
'layer/vector/canvas/CircleMarker.Canvas.js'],
|
|
148
|
+
deps: ['PathCanvas', 'Polyline', 'Polygon', 'Circle', 'CircleMarker'],
|
|
149
|
+
desc: 'Canvas fallback for vector layers (polygons, polylines, circles, circlemarkers)'
|
|
149
150
|
},
|
|
150
151
|
|
|
151
152
|
GeoJSON: {
|
|
152
153
|
src: ['layer/GeoJSON.js'],
|
|
153
|
-
deps: ['Marker', 'MultiPoly', 'FeatureGroup'],
|
|
154
|
+
deps: ['CircleMarker', 'Marker', 'MultiPoly', 'FeatureGroup'],
|
|
154
155
|
desc: 'GeoJSON layer, parses the data and adds corresponding layers above.'
|
|
155
156
|
},
|
|
156
157
|
|
|
@@ -175,11 +176,12 @@ var deps = {
|
|
|
175
176
|
TouchZoom: {
|
|
176
177
|
src: ['dom/DomEvent.js',
|
|
177
178
|
'dom/DomEvent.DoubleTap.js',
|
|
178
|
-
'dom/DomEvent.
|
|
179
|
+
'dom/DomEvent.Pointer.js',
|
|
179
180
|
'core/Handler.js',
|
|
180
|
-
'map/handler/Map.TouchZoom.js'
|
|
181
|
+
'map/handler/Map.TouchZoom.js',
|
|
182
|
+
'map/handler/Map.Tap.js'],
|
|
181
183
|
deps: ['AnimationZoom'],
|
|
182
|
-
desc: 'Enables smooth touch
|
|
184
|
+
desc: 'Enables smooth touch zoom / tap / longhold / doubletap on iOS, IE10, Android.'
|
|
183
185
|
},
|
|
184
186
|
|
|
185
187
|
BoxZoom: {
|
|
@@ -229,6 +231,7 @@ var deps = {
|
|
|
229
231
|
'dom/PosAnimation.js',
|
|
230
232
|
'map/anim/Map.PanAnimation.js'
|
|
231
233
|
],
|
|
234
|
+
heading: 'Animation',
|
|
232
235
|
desc: 'Core panning animation support.'
|
|
233
236
|
},
|
|
234
237
|
|
data/lib/leaflet/build/hintrc.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
{
|
|
3
2
|
// environment
|
|
4
3
|
"browser": true,
|
|
5
4
|
"node": true,
|
|
6
|
-
"
|
|
5
|
+
"globals": {
|
|
6
|
+
"L": true,
|
|
7
|
+
"define": true
|
|
8
|
+
},
|
|
7
9
|
"strict": false,
|
|
8
10
|
|
|
9
11
|
// code style
|
|
@@ -34,4 +36,4 @@ exports.config = {
|
|
|
34
36
|
// "maxcomplexity": 5
|
|
35
37
|
// "maxparams": 4,
|
|
36
38
|
// "maxdepth": 4
|
|
37
|
-
}
|
|
39
|
+
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
<title>Leaflet debug page</title>
|
|
5
5
|
|
|
6
6
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
7
|
-
<!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->
|
|
8
7
|
|
|
9
8
|
<meta name="viewport" content="width=device-width,initial-scale=1 maximum-scale=1.0 user-scalable=0">
|
|
10
9
|
<link rel="stylesheet" href="../css/screen.css" />
|