Skip to content

Commit

Permalink
fix: expect id as layer property
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertOrthofer committed Aug 28, 2023
1 parent f6f6fbc commit 3abc733
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions elements/map/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ const availableSources = {

export type EoxLayer = {
type: layerType;
id?: string;
properties?: object;
properties: object & {
id: string
};
source?: { type: sourceType };
layers?: Array<EoxLayer>;
style?: mapboxgl.Style | FlatStyleLike;
Expand Down Expand Up @@ -84,7 +85,7 @@ export function createLayer(layer: EoxLayer, group?: string): olLayers.Layer {
}),
style: undefined, // override layer style, apply style after
...(layer.type === "Group" && {
layers: layer.layers.reverse().map((l) => createLayer(l, layer.id)),
layers: layer.layers.reverse().map((l) => createLayer(l, layer.properties.id)),
}),
});

Expand Down
4 changes: 3 additions & 1 deletion elements/map/src/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ export async function addSelect(
layerDefinition = {
style: options.style,
type,
id: "asd",
properties: {
id: layerId + '_select'
},
source: {
type,
},
Expand Down

0 comments on commit 3abc733

Please sign in to comment.