Skip to content

Commit

Permalink
Merge branch 'master' into https-osm
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey authored Mar 14, 2018
2 parents b14f69c + 4570da4 commit 393ac73
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/color-legend/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"about": {
"text": "This example shows how to create a discrete or continous color legends."
},
"disabled": true
"disabled": false
}
1 change: 1 addition & 0 deletions tutorials/editor/tutorial.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"title": "Editor",
"hideNavbar": true,
"level": 10,
"order": 0,
"tutorialJs": ["editor.js"],
"about": {
"text": "Edit and save work in URL."
Expand Down
7 changes: 7 additions & 0 deletions tutorials/editor3/editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* global start_tutorial */

$(function () {
/* start_tutorial has to be called explicitly when we are ready since we need
* to ask it to always keep url changes. */
start_tutorial(undefined, true);
});
69 changes: 69 additions & 0 deletions tutorials/editor3/index.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
extends ../common/index.pug

block mainTutorial
:markdown-it
# Editor with HTML and CSS
Any changes made will be stored in the URL whenever the code is run. This can be sent as a link, bookmarked, or otherwise shared.

You can interact with the code through the javascript console by accessing the top-level variables in the `tutorial` global parameter.

:markdown-it
**HTML**
+codeblock('html', 1).
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../built/geo.ext.min.js"></script>
<script type="text/javascript" src="../../built/geo.min.js"></script>
<!-- Use a specific version of GeoJS by requesting it from a CDN.
For instance, remove the local references, above, and
uncomment the following:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/geojs/0.15.1/geo.ext.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/geojs/0.15.1/geo.min.js"></script>
-->
</head>
<body>
<div id="map"></div>
<div id="info"></div>
</body>
</html>

:markdown-it
**CSS**
+codeblock('css', 2).
html,body,#map{
width: 100%;
height: 100%;
padding: 0;
margin: 0;
overflow: hidden;
}
#info {
position: absolute;
top: 0;
right: 0;
background: rgba(255,255,255,0.75);
padding: 2px;
}

:markdown-it
**Javascript**
+codeblock('javascript', 3, undefined, true).
var map = geo.map({
node: "#map",
center: {x: 0.2, y: 49.5},
zoom: 11
});
var layer = map.createLayer('osm');
$('#info').text('GeoJS version: ' + geo.version);
map.geoOn(geo.event.mousemove, function (evt) {
$('#info').text('x: ' + evt.geo.x.toFixed(6) + ', y: ' + evt.geo.y.toFixed(6));
})
+codeblock_test('map has one osm layer from openstreetmap', [
'map.layers().length === 1',
'map.layers()[0] instanceof geo.osmLayer',
'layer.url().match(/openstreetmap/)'
])
+codeblock_test('map has a non-empty info div', [
'$("#info").text()'
])
Binary file added tutorials/editor3/thumb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions tutorials/editor3/tutorial.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Editor with HTML and CSS",
"hideNavbar": true,
"level": 10,
"order": 1,
"tutorialJs": ["editor.js"],
"about": {
"text": "Edit and save work in URL. Edit the HTML to try different versions of GeoJS."
}
}
5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ module.exports = {
root: 'Hammer',
commonjs: 'hammerjs',
commonjs2: 'hammerjs',
amd: 'hammerjs'
amd: 'hammerjs',
// Since GeoJS's libraryTarget is "umd", defining this (undocumented) external library type
// will allow Webpack to create a better error message if a "hammerjs" import fails
umd: 'hammerjs'
}
},
plugins: [
Expand Down

0 comments on commit 393ac73

Please sign in to comment.