Avoid use of goog.array.clone with arrays
This commit is contained in:
@@ -78,7 +78,7 @@ ol.FeatureOverlay = function(opt_options) {
|
||||
|
||||
if (goog.isDef(options.features)) {
|
||||
if (goog.isArray(options.features)) {
|
||||
this.setFeatures(new ol.Collection(goog.array.clone(options.features)));
|
||||
this.setFeatures(new ol.Collection(options.features.slice()));
|
||||
} else {
|
||||
goog.asserts.assertInstanceof(options.features, ol.Collection);
|
||||
this.setFeatures(options.features);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
goog.provide('ol.format.Feature');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.proj');
|
||||
|
||||
@@ -177,7 +176,7 @@ ol.format.Feature.transformWithOptions = function(
|
||||
// FIXME this is necessary because ol.format.GML treats extents
|
||||
// as geometries
|
||||
return ol.proj.transformExtent(
|
||||
write ? goog.array.clone(geometry) : geometry,
|
||||
write ? geometry.slice() : geometry,
|
||||
write ? featureProjection : dataProjection,
|
||||
write ? dataProjection : featureProjection);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ ol.layer.Group = function(opt_options) {
|
||||
|
||||
if (goog.isDefAndNotNull(layers)) {
|
||||
if (goog.isArray(layers)) {
|
||||
layers = new ol.Collection(goog.array.clone(layers));
|
||||
layers = new ol.Collection(layers.slice());
|
||||
} else {
|
||||
goog.asserts.assertInstanceof(layers, ol.Collection);
|
||||
layers = layers;
|
||||
|
||||
@@ -1500,7 +1500,7 @@ ol.Map.createOptionsInternal = function(options) {
|
||||
var controls;
|
||||
if (goog.isDef(options.controls)) {
|
||||
if (goog.isArray(options.controls)) {
|
||||
controls = new ol.Collection(goog.array.clone(options.controls));
|
||||
controls = new ol.Collection(options.controls.slice());
|
||||
} else {
|
||||
goog.asserts.assertInstanceof(options.controls, ol.Collection);
|
||||
controls = options.controls;
|
||||
@@ -1512,7 +1512,7 @@ ol.Map.createOptionsInternal = function(options) {
|
||||
var interactions;
|
||||
if (goog.isDef(options.interactions)) {
|
||||
if (goog.isArray(options.interactions)) {
|
||||
interactions = new ol.Collection(goog.array.clone(options.interactions));
|
||||
interactions = new ol.Collection(options.interactions.slice());
|
||||
} else {
|
||||
goog.asserts.assertInstanceof(options.interactions, ol.Collection);
|
||||
interactions = options.interactions;
|
||||
@@ -1524,7 +1524,7 @@ ol.Map.createOptionsInternal = function(options) {
|
||||
var overlays;
|
||||
if (goog.isDef(options.overlays)) {
|
||||
if (goog.isArray(options.overlays)) {
|
||||
overlays = new ol.Collection(goog.array.clone(options.overlays));
|
||||
overlays = new ol.Collection(options.overlays.slice());
|
||||
} else {
|
||||
goog.asserts.assertInstanceof(options.overlays, ol.Collection);
|
||||
overlays = options.overlays;
|
||||
|
||||
@@ -260,7 +260,7 @@ goog.exportProperty(
|
||||
* @return {Array.<number>} Hint.
|
||||
*/
|
||||
ol.View.prototype.getHints = function() {
|
||||
return goog.array.clone(this.hints_);
|
||||
return this.hints_.slice();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user