diff options
| author | Yuval Adam <yuval@y3xz.com> | 2016-01-08 22:38:20 +0200 |
|---|---|---|
| committer | Yuval Adam <yuval@y3xz.com> | 2016-01-08 22:38:20 +0200 |
| commit | 43f3f900ed3b3664a2a38e24f5b3a49a1d33f21b (patch) | |
| tree | 3d1ea1a8374e9594559bc5e110bb1f735de72096 | |
| parent | f745a835e841bdb48f36705fe08b7b4209ff37d3 (diff) | |
Fix new props zoom/slide behavior
| -rw-r--r-- | geshem.js | 11 | ||||
| -rw-r--r-- | static/js/bundle.js | 14 |
2 files changed, 12 insertions, 13 deletions
@@ -101,21 +101,19 @@ class GLMap extends React.Component { this._addRadarSource('280', i, v) this._addRadarLayer('280', i++) } + this.map.setPaintProperty('radar-280-0', 'raster-opacity', 0.85) }) } - componentWillReceiveProps () { + componentWillReceiveProps (props) { this.map.setPaintProperty('radar-' + this.state.res + '-' + this.state.slider, 'raster-opacity', 0) + this.map.setPaintProperty('radar-' + this.state.res + '-' + props.slider, 'raster-opacity', 0.85) this.setState({ 'res': this.state.res, - 'slider': this.props.slider + 'slider': props.slider }) } - componentDidUpdate () { - this.map.setPaintProperty('radar-' + this.state.res + '-' + this.state.slider, 'raster-opacity', 0.85) - } - componentWillUnmount () { this.map.remove() } @@ -128,6 +126,7 @@ class GLMap extends React.Component { class Map extends React.Component { onChangeHandler = (e) => { + console.log('handle', e) this.setState({ 'slider': 7-e }) diff --git a/static/js/bundle.js b/static/js/bundle.js index 7cf4f57..80b017b 100644 --- a/static/js/bundle.js +++ b/static/js/bundle.js @@ -204,23 +204,22 @@ } } } + + _this2.map.setPaintProperty('radar-280-0', 'raster-opacity', 0.85); }); } }, { key: 'componentWillReceiveProps', - value: function componentWillReceiveProps() { + value: function componentWillReceiveProps(props) { + console.log('old' + this.state.slider, 'new' + props.slider); this.map.setPaintProperty('radar-' + this.state.res + '-' + this.state.slider, 'raster-opacity', 0); + this.map.setPaintProperty('radar-' + this.state.res + '-' + props.slider, 'raster-opacity', 0.85); this.setState({ 'res': this.state.res, - 'slider': this.props.slider + 'slider': props.slider }); } }, { - key: 'componentDidUpdate', - value: function componentDidUpdate() { - this.map.setPaintProperty('radar-' + this.state.res + '-' + this.state.slider, 'raster-opacity', 0.85); - } - }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.map.remove(); @@ -248,6 +247,7 @@ var _this3 = _possibleConstructorReturn(this, Object.getPrototypeOf(Map).call(this, props)); _this3.onChangeHandler = function (e) { + console.log('handle', e); _this3.setState({ 'slider': 7 - e }); |
