diff --git a/src/pixelmapLayer.js b/src/pixelmapLayer.js index fa9ba006a4..499245408d 100644 --- a/src/pixelmapLayer.js +++ b/src/pixelmapLayer.js @@ -41,6 +41,12 @@ var pixelmapLayer = function (arg) { return new pixelmapLayer(arg); } arg = arg || {}; + /* Don't extend data from args -- it can be very slow */ + let argdata; + if (arg.data) { + argdata = arg.data; + delete arg.data; + } arg = $.extend( true, {}, @@ -99,8 +105,8 @@ var pixelmapLayer = function (arg) { pixelmapArgs.color = arg.color; } m_pixelmapFeature = m_this.createFeature('pixelmap', pixelmapArgs); - if (arg.data) { - m_pixelmapFeature.data(arg.data); + if (argdata) { + m_pixelmapFeature.data(argdata); } m_this.style = m_pixelmapFeature.style; m_this.data = m_pixelmapFeature.data; diff --git a/src/registry.js b/src/registry.js index 4a0e8efb58..f17165d739 100644 --- a/src/registry.js +++ b/src/registry.js @@ -313,7 +313,12 @@ util.createLayer = function (name, map, arg) { options.features = layerDefaultFeatures[name]; } if (arg !== undefined) { + const argdata = arg.data; + delete arg.data; $.extend(true, options, arg); + if (argdata) { + options.data = argdata; + } } layer = layers[name](options); layer.layerName = name;