summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorYuval Adam <yuval@y3xz.com>2016-01-08 19:07:42 +0200
committerYuval Adam <yuval@y3xz.com>2016-01-08 19:07:42 +0200
commitf745a835e841bdb48f36705fe08b7b4209ff37d3 (patch)
tree25b7aca4430843a4af28cee4fb428c34c33adfc7 /static
parenteb6088ed9e9e518a93e0da10181b54ed8b64c95e (diff)
Fix zooming behavior
Diffstat (limited to 'static')
-rw-r--r--static/js/bundle.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/static/js/bundle.js b/static/js/bundle.js
index b7ea716..7cf4f57 100644
--- a/static/js/bundle.js
+++ b/static/js/bundle.js
@@ -134,11 +134,19 @@
this.map.on('zoom', function (e) {
if (_this2.map.getZoom() > 7) {
- _this2.map.getLayer('radar-140-0').setLayoutProperty('visibility', 'visible');
- _this2.map.getLayer('radar-280-0').setLayoutProperty('visibility', 'none');
+ _this2.map.setPaintProperty('radar-140-' + _this2.state.slider, 'raster-opacity', 0.85);
+ _this2.map.setPaintProperty('radar-280-' + _this2.state.slider, 'raster-opacity', 0);
+ _this2.setState({
+ 'res': '140',
+ 'slider': _this2.state.slider
+ });
} else {
- _this2.map.getLayer('radar-140-0').setLayoutProperty('visibility', 'none');
- _this2.map.getLayer('radar-280-0').setLayoutProperty('visibility', 'visible');
+ _this2.map.setPaintProperty('radar-140-' + _this2.state.slider, 'raster-opacity', 0);
+ _this2.map.setPaintProperty('radar-280-' + _this2.state.slider, 'raster-opacity', 0.85);
+ _this2.setState({
+ 'res': '280',
+ 'slider': _this2.state.slider
+ });
}
});
@@ -201,17 +209,16 @@
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps() {
- this.map.setPaintProperty('radar-280-' + this.state.slider, 'raster-opacity', 0);
+ this.map.setPaintProperty('radar-' + this.state.res + '-' + this.state.slider, 'raster-opacity', 0);
this.setState({
- 'res': '280',
+ 'res': this.state.res,
'slider': this.props.slider
});
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
- this.map.setPaintProperty('radar-280-' + this.state.slider, 'raster-opacity', 0.85);
- console.log(this.map.getLayer('radar-280-' + this.props.slider));
+ this.map.setPaintProperty('radar-' + this.state.res + '-' + this.state.slider, 'raster-opacity', 0.85);
}
}, {
key: 'componentWillUnmount',