From db6b9ac176142b30678714d1b3975d27f324582c Mon Sep 17 00:00:00 2001 From: orangemug Date: Thu, 20 Sep 2018 19:26:53 +0100 Subject: [PATCH 01/11] Added OS Open Zoomstack and styles --- src/config/styles.json | 24 ++++++++++++++++++++++++ src/config/tilesets.json | 5 +++++ 2 files changed, 29 insertions(+) diff --git a/src/config/styles.json b/src/config/styles.json index d89e3f34..502ff55f 100644 --- a/src/config/styles.json +++ b/src/config/styles.json @@ -52,5 +52,29 @@ "title": "Mapbox Basic", "url": "https://rawgit.com/mapbox/mapbox-gl-styles/master/styles/basic-v9.json", "thumbnail": "https://maputnik.github.io/thumbnails/mapbox-basic.png" + }, + { + "id": "os-zoomstack-outdoor", + "title": "Zoomstack Outdoor", + "url": "https://s3-eu-west-1.amazonaws.com/tiles.os.uk/styles/open-zoomstack-outdoor/style.json", + "thumbnail": "https://maputnik.github.io/thumbnails/mapbox-basic.png" + }, + { + "id": "os-zoomstack-road", + "title": "Zoomstack Road", + "url": "https://s3-eu-west-1.amazonaws.com/tiles.os.uk/styles/open-zoomstack-road/style.json", + "thumbnail": "https://maputnik.github.io/thumbnails/mapbox-basic.png" + }, + { + "id": "os-zoomstack-light", + "title": "Zoomstack Light", + "url": "https://s3-eu-west-1.amazonaws.com/tiles.os.uk/styles/open-zoomstack-light/style.json", + "thumbnail": "https://maputnik.github.io/thumbnails/mapbox-basic.png" + }, + { + "id": "os-zoomstack-night", + "title": "Zoomstack Night", + "url": "https://s3-eu-west-1.amazonaws.com/tiles.os.uk/styles/open-zoomstack-night/style.json", + "thumbnail": "https://maputnik.github.io/thumbnails/mapbox-basic.png" } ] diff --git a/src/config/tilesets.json b/src/config/tilesets.json index 136963e1..0b81da83 100644 --- a/src/config/tilesets.json +++ b/src/config/tilesets.json @@ -18,5 +18,10 @@ "type": "vector", "url": "https://tile.thunderforest.com/thunderforest.outdoors-v1.json?apikey={key}", "title": "Thunderforest Outdoors (heavy)" + }, + "open_zoomstack": { + "type": "vector", + "url": "https://s3-eu-west-1.amazonaws.com/tiles.os.uk/data/vector/open-zoomstack/config.json", + "title": "OS Open Zoomstack" } } From a0ed6a379bf268e11c69e6cb0d753ccbc82a6922 Mon Sep 17 00:00:00 2001 From: orangemug Date: Sun, 23 Sep 2018 09:05:08 +0100 Subject: [PATCH 02/11] Always show layer visibility toggle in layer list --- src/components/layers/LayerListItem.jsx | 13 +++++++++-- src/styles/_layer.scss | 29 +++++++++++++++++-------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/components/layers/LayerListItem.jsx b/src/components/layers/LayerListItem.jsx index 805e50fc..d1bf0d43 100644 --- a/src/components/layers/LayerListItem.jsx +++ b/src/components/layers/LayerListItem.jsx @@ -31,7 +31,8 @@ class IconAction extends React.Component { static propTypes = { action: PropTypes.string.isRequired, onClick: PropTypes.func.isRequired, - wdKey: PropTypes.string + wdKey: PropTypes.string, + classBlockName: PropTypes.string, } renderIcon() { @@ -44,10 +45,15 @@ class IconAction extends React.Component { } render() { + let classAdditions = ''; + if (this.props.classBlockName) { + classAdditions = `maputnik-layer-list-icon-action__${this.props.classBlockName}`; + } + return + diff --git a/src/styles/_components.scss b/src/styles/_components.scss index 302ec528..58ab88f0 100644 --- a/src/styles/_components.scss +++ b/src/styles/_components.scss @@ -77,6 +77,12 @@ background-color: lighten($color-midgray, 12); color: $color-white; } + + &:disabled { + background-color: darken($color-midgray, 5); + color: $color-midgray; + cursor: not-allowed; + } } .maputnik-big-button { From 4a0b9fd0de6762b50a9e4ff3f68c3da3e3d6e04e Mon Sep 17 00:00:00 2001 From: orangemug Date: Mon, 24 Sep 2018 15:13:35 +0100 Subject: [PATCH 04/11] Added missing prop type --- src/components/Button.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Button.jsx b/src/components/Button.jsx index 294c47fd..0d350b0d 100644 --- a/src/components/Button.jsx +++ b/src/components/Button.jsx @@ -9,7 +9,8 @@ class Button extends React.Component { onClick: PropTypes.func, style: PropTypes.object, className: PropTypes.string, - children: PropTypes.node + children: PropTypes.node, + disabled: PropTypes.bool, } render() { From bc1d0de0572017cb72387abf2ed9f5d3d8296099 Mon Sep 17 00:00:00 2001 From: orangemug Date: Mon, 24 Sep 2018 16:55:31 +0100 Subject: [PATCH 05/11] Added default isActive prop to Collapse component --- src/components/layers/Collapse.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/layers/Collapse.jsx b/src/components/layers/Collapse.jsx index aeaa09b0..cea85238 100644 --- a/src/components/layers/Collapse.jsx +++ b/src/components/layers/Collapse.jsx @@ -10,6 +10,10 @@ export default class CollapseAlt extends React.Component { children: PropTypes.element.isRequired } + static defaultProps = { + isActive: true + } + render() { if (accessibility.reducedMotionEnabled()) { return ( From 252403b1e3da70ddacf0a3fbeaf52473164502ce Mon Sep 17 00:00:00 2001 From: orangemug Date: Mon, 24 Sep 2018 20:40:51 +0100 Subject: [PATCH 06/11] Added classBlockModifier to and switched to only displaying icons for hidden layers --- src/components/layers/LayerListItem.jsx | 16 +++++++++++++--- src/styles/_layer.scss | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/layers/LayerListItem.jsx b/src/components/layers/LayerListItem.jsx index 49ced9bd..322c272e 100644 --- a/src/components/layers/LayerListItem.jsx +++ b/src/components/layers/LayerListItem.jsx @@ -33,6 +33,7 @@ class IconAction extends React.Component { onClick: PropTypes.func.isRequired, wdKey: PropTypes.string, classBlockName: PropTypes.string, + classBlockModifier: PropTypes.string, } renderIcon() { @@ -45,9 +46,15 @@ class IconAction extends React.Component { } render() { + const {classBlockName, classBlockModifier} = this.props; + let classAdditions = ''; - if (this.props.classBlockName) { - classAdditions = `maputnik-layer-list-icon-action__${this.props.classBlockName}`; + if (classBlockName) { + classAdditions = `maputnik-layer-list-icon-action__${classBlockName}`; + + if (classBlockModifier) { + classAdditions += ` maputnik-layer-list-icon-action__${classBlockName}--${classBlockModifier}`; + } } return From 8b0ae178b8fca41a2269c751a2ddcdccbd066f32 Mon Sep 17 00:00:00 2001 From: orangemug Date: Mon, 24 Sep 2018 21:17:41 +0100 Subject: [PATCH 08/11] Added in thumbnails --- src/config/styles.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/config/styles.json b/src/config/styles.json index 7a122b7d..8f922f54 100644 --- a/src/config/styles.json +++ b/src/config/styles.json @@ -34,28 +34,29 @@ "title": "Empty Style", "url": "https://rawgit.com/maputnik/editor/master/src/config/empty-style.json", "thumbnail": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAECAQAAAAHDYbIAAAAEUlEQVR42mP8/58BDhiJ4wAA974H/U5Xe1oAAAAASUVORK5CYII=" + }, { "id": "os-zoomstack-outdoor", "title": "Zoomstack Outdoor", "url": "https://s3-eu-west-1.amazonaws.com/tiles.os.uk/styles/open-zoomstack-outdoor/style.json", - "thumbnail": "https://maputnik.github.io/thumbnails/mapbox-basic.png" + "thumbnail": "https://maputnik.github.io/thumbnails/os-zoomstack-outdoor.png" }, { "id": "os-zoomstack-road", "title": "Zoomstack Road", "url": "https://s3-eu-west-1.amazonaws.com/tiles.os.uk/styles/open-zoomstack-road/style.json", - "thumbnail": "https://maputnik.github.io/thumbnails/mapbox-basic.png" + "thumbnail": "https://maputnik.github.io/thumbnails/os-zoomstack-road.png" }, { "id": "os-zoomstack-light", "title": "Zoomstack Light", "url": "https://s3-eu-west-1.amazonaws.com/tiles.os.uk/styles/open-zoomstack-light/style.json", - "thumbnail": "https://maputnik.github.io/thumbnails/mapbox-basic.png" + "thumbnail": "https://maputnik.github.io/thumbnails/os-zoomstack-light.png" }, { "id": "os-zoomstack-night", "title": "Zoomstack Night", "url": "https://s3-eu-west-1.amazonaws.com/tiles.os.uk/styles/open-zoomstack-night/style.json", - "thumbnail": "https://maputnik.github.io/thumbnails/mapbox-basic.png" + "thumbnail": "https://maputnik.github.io/thumbnails/os-zoomstack-night.png" } ] From f9de73e18aa263a0523afbc23102ca865236844a Mon Sep 17 00:00:00 2001 From: pathmapper Date: Mon, 1 Oct 2018 10:13:00 +0200 Subject: [PATCH 09/11] Update tilehosting URL --- src/config/tilesets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/tilesets.json b/src/config/tilesets.json index 11507c8e..5743fd7a 100644 --- a/src/config/tilesets.json +++ b/src/config/tilesets.json @@ -1,7 +1,7 @@ { "openmaptiles": { "type": "vector", - "url": "https://free.tilehosting.com/data/v3.json?key={key}", + "url": "https://maps.tilehosting.com/data/v3.json?key={key}", "title": "OpenMapTiles" }, "thunderforest_transport": { From 4c13350c14376706735cc69c5d9f25f9fc8a78a0 Mon Sep 17 00:00:00 2001 From: Robin Summerhill Date: Wed, 3 Oct 2018 20:11:53 +0100 Subject: [PATCH 10/11] Issue #380 - fix for data functions --- src/components/fields/FunctionSpecField.jsx | 18 +++++++++++++++--- src/components/fields/_DataProperty.jsx | 8 ++++---- src/components/fields/_FunctionButtons.jsx | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/components/fields/FunctionSpecField.jsx b/src/components/fields/FunctionSpecField.jsx index 3067c1b4..36d79309 100644 --- a/src/components/fields/FunctionSpecField.jsx +++ b/src/components/fields/FunctionSpecField.jsx @@ -32,6 +32,16 @@ export default class FunctionSpecProperty extends React.Component { ]), } + getFieldFunctionType(fieldSpec) { + if (fieldSpec.expression.interpolated) { + return "exponential" + } + if (fieldSpec.type === "number") { + return "interval" + } + return "categorical" + } + addStop = () => { const stops = this.props.value.stops.slice(0) const lastStop = stops[stops.length - 1] @@ -80,12 +90,14 @@ export default class FunctionSpecProperty extends React.Component { } makeDataFunction = () => { + const functionType = this.getFieldFunctionType(this.props.fieldSpec); + const stopValue = functionType === 'categorical' ? '' : 0; const dataFunc = { property: "", - type: "categorical", + type: functionType, stops: [ - [{zoom: 6, value: 0}, this.props.value], - [{zoom: 10, value: 0}, this.props.value] + [{zoom: 6, value: stopValue}, this.props.value || stopValue], + [{zoom: 10, value: stopValue}, this.props.value || stopValue] ] } this.props.onChange(this.props.fieldName, dataFunc) diff --git a/src/components/fields/_DataProperty.jsx b/src/components/fields/_DataProperty.jsx index 9fa1e440..4116031f 100644 --- a/src/components/fields/_DataProperty.jsx +++ b/src/components/fields/_DataProperty.jsx @@ -30,7 +30,7 @@ export default class DataProperty extends React.Component { } getFieldFunctionType(fieldSpec) { - if (fieldSpec.function === "interpolated") { + if (fieldSpec.expression.interpolated) { return "exponential" } if (fieldSpec.type === "number") { @@ -39,8 +39,8 @@ export default class DataProperty extends React.Component { return "categorical" } - getDataFunctionTypes(functionType) { - if (functionType === "interpolated") { + getDataFunctionTypes(fieldSpec) { + if (fieldSpec.expression.interpolated) { return ["categorical", "interval", "exponential"] } else { @@ -150,7 +150,7 @@ export default class DataProperty extends React.Component { this.changeDataProperty("type", propVal)} - options={this.getDataFunctionTypes(this.props.fieldSpec.function)} + options={this.getDataFunctionTypes(this.props.fieldSpec)} /> diff --git a/src/components/fields/_FunctionButtons.jsx b/src/components/fields/_FunctionButtons.jsx index 99756134..ffd6552c 100644 --- a/src/components/fields/_FunctionButtons.jsx +++ b/src/components/fields/_FunctionButtons.jsx @@ -28,7 +28,7 @@ export default class FunctionButtons extends React.Component { /> - if (this.props.fieldSpec['property-function'] && ['piecewise-constant', 'interpolated'].indexOf(this.props.fieldSpec['function']) !== -1) { + if (this.props.fieldSpec['property-type'] === 'data-driven') { makeDataButton =