@planet/layers
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -7,6 +7,2 @@ 'use strict'; | ||
var _assign = require('babel-runtime/core-js/object/assign'); | ||
var _assign2 = _interopRequireDefault(_assign); | ||
var _tile = require('ol/layer/tile'); | ||
@@ -20,2 +16,6 @@ | ||
var _source = require('ol/source/source'); | ||
var _source2 = _interopRequireDefault(_source); | ||
var _xyz = require('ol/source/xyz'); | ||
@@ -51,5 +51,10 @@ | ||
componentWillMount: function componentWillMount() { | ||
var source = this.props.souce instanceof _source2.default ? this.props.source : new _xyz2.default(this.props.source); | ||
if (this.props.url) { | ||
source.setUrl(this.props.url); | ||
} | ||
this.layer = new _tile2.default({ | ||
extent: this.getTransformedExtent(this.props.extent), | ||
source: new _xyz2.default((0, _assign2.default)({ url: this.props.url }, this.props.source)) | ||
source: source, | ||
extent: this.getTransformedExtent(this.props.extent) | ||
}); | ||
@@ -59,4 +64,6 @@ }, | ||
if (!(0, _lodash2.default)(nextProps.source, this.props.source)) { | ||
this.layer.setSource(new _xyz2.default((0, _assign2.default)({ url: nextProps.url }, nextProps.source))); | ||
} else if (nextProps.url !== this.props.url) { | ||
this.layer.setSource(nextProps.source instanceof _source2.default ? nextProps.source : new _xyz2.default(nextProps.source)); | ||
} | ||
if (nextProps.url !== this.props.url) { | ||
this.layer.getSource().setUrl(nextProps.url); | ||
@@ -63,0 +70,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import _Object$assign from 'babel-runtime/core-js/object/assign'; | ||
import OLTileLayer from 'ol/layer/tile'; | ||
import PropTypes from 'prop-types'; | ||
import Source from 'ol/source/source'; | ||
import XYZSource from 'ol/source/xyz'; | ||
@@ -20,5 +20,10 @@ import createLayer from './createLayer'; | ||
componentWillMount: function componentWillMount() { | ||
var source = this.props.souce instanceof Source ? this.props.source : new XYZSource(this.props.source); | ||
if (this.props.url) { | ||
source.setUrl(this.props.url); | ||
} | ||
this.layer = new OLTileLayer({ | ||
extent: this.getTransformedExtent(this.props.extent), | ||
source: new XYZSource(_Object$assign({ url: this.props.url }, this.props.source)) | ||
source: source, | ||
extent: this.getTransformedExtent(this.props.extent) | ||
}); | ||
@@ -28,4 +33,6 @@ }, | ||
if (!isEqual(nextProps.source, this.props.source)) { | ||
this.layer.setSource(new XYZSource(_Object$assign({ url: nextProps.url }, nextProps.source))); | ||
} else if (nextProps.url !== this.props.url) { | ||
this.layer.setSource(nextProps.source instanceof Source ? nextProps.source : new XYZSource(nextProps.source)); | ||
} | ||
if (nextProps.url !== this.props.url) { | ||
this.layer.getSource().setUrl(nextProps.url); | ||
@@ -32,0 +39,0 @@ } |
{ | ||
"name": "@planet/layers", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "React components for OpenLayers", | ||
@@ -5,0 +5,0 @@ "module": "lib/index.js", |
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
47586
26
1283