Skip to content

Commit

Permalink
feature: defaultLayerParams in config (origo-map#1727)
Browse files Browse the repository at this point in the history
* Added defaultLayerParams

* Update viewer.js
  • Loading branch information
jokd committed Mar 31, 2023
1 parent 33233b0 commit 0a35356
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const Viewer = function Viewer(targetOption, options = {}) {
zoom: zoomOption = 0,
resolutions = null,
layers: layerOptions = [],
layerParams = {},
map: mapName,
params: urlParams = {},
proj4Defs,
Expand Down Expand Up @@ -407,7 +408,11 @@ const Viewer = function Viewer(targetOption, options = {}) {
}
};

const addLayer = function addLayer(layerProps, insertBefore) {
const addLayer = function addLayer(thisProps, insertBefore) {
let layerProps = thisProps;
if (thisProps.layerParam && layerParams[thisProps.layerParam]) {
layerProps = Object.assign({}, layerParams[thisProps.layerParam], thisProps);
}
const layer = Layer(layerProps, this);
addLayerStylePicker(layerProps);
if (insertBefore) {
Expand Down

0 comments on commit 0a35356

Please sign in to comment.