kosmtik-map-compare
Advanced tools
Comparing version 0.0.4 to 0.0.5
36
front.js
@@ -22,3 +22,3 @@ L.K.Map.addInitHook(function () { | ||
var builder = new L.K.FormBuilder(params, [ | ||
['active', {handler: L.K.Switch, label: 'Active'}], | ||
['active', {handler: L.K.Switch, label: 'Active (ctrl+alt+C)'}], | ||
['tms', {handler: L.K.Switch, label: 'TMS format.'}], | ||
@@ -28,13 +28,16 @@ ['url', {handler: 'BlurInput', helpText: 'URL template.'}] | ||
// TODO vertical / horizontal view | ||
var toggle = function () { | ||
if (params.active) { | ||
if (!otherMap) init(); | ||
L.DomUtil.addClass(document.body, 'map-compare-on'); | ||
otherMap.invalidateSize(); | ||
this.invalidateSize(); | ||
} else { | ||
L.DomUtil.removeClass(document.body, 'map-compare-on'); | ||
this.invalidateSize(); | ||
} | ||
} | ||
builder.on('synced', function (e) { | ||
if (e.field === 'active') { | ||
if (params.active) { | ||
if (!otherMap) init(); | ||
L.DomUtil.addClass(document.body, 'map-compare-on'); | ||
otherMap.invalidateSize(); | ||
this.invalidateSize(); | ||
} else { | ||
L.DomUtil.removeClass(document.body, 'map-compare-on'); | ||
this.invalidateSize(); | ||
} | ||
L.bind(toggle, this)(); | ||
} else if (e.field === 'url' && tilelayer) { | ||
@@ -50,3 +53,16 @@ tilelayer.setUrl(params.url); | ||
this.sidebar.rebuild(); | ||
var shortcutCallback = function () { | ||
params.active = !params.active; | ||
L.bind(toggle, this)(); | ||
builder.fetchAll(); | ||
}; | ||
this.shortcuts.add({ | ||
keyCode: L.K.Keys.C, | ||
ctrlKey: true, | ||
altKey: true, | ||
callback: shortcutCallback, | ||
context: this, | ||
description: 'Toggle map compare view' | ||
}); | ||
}); | ||
}); |
{ | ||
"name": "kosmtik-map-compare", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Add a map to compare side-by-side with your work", | ||
@@ -25,3 +25,3 @@ "main": "index.js", | ||
"homepage": "https://github.com/kosmtik/kosmtik-map-compare", | ||
"kosmtik": "~0.0.3" | ||
"kosmtik": "~0.0.5" | ||
} |
@@ -12,4 +12,9 @@ # kosmtik-map-compare | ||
## Config | ||
You can add `compareUrl` key to your `project.mml` or your kosmtik `config.yml` | ||
files to set the default URL used. Fallback to OSM default style. | ||
## Preview | ||
![screenshot](https://raw.github.com/kosmtik/kosmtik-map-compare/master/screenshot.png "Screenshot of Kosmtik") |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79170
91
20