Skip to content

Commit ff83346

Browse files
committed
fix(ol-*-layer): add missing prop displayInLayerSwitcher
closes #412
1 parent 5dae1c3 commit ff83346

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

Diff for: src/components/layers/LayersCommonProps.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import type { KeysMatching, ObjectToFactory } from "@/types";
1+
import type {
2+
KeysMatching,
3+
LayerSwitcherOptions,
4+
ObjectToFactory,
5+
} from "@/types";
26
import type { Options } from "ol/layer/Layer";
37
import type { Source } from "ol/source";
48
import type VectorSource from "ol/source/Vector";
@@ -7,12 +11,14 @@ export type LayersCommonProps<T extends Source = VectorSource> = Partial<
711
Options<T>
812
>;
913

10-
export const layersCommonDefaultProps: Options<Source> = {
11-
className: "ol-layer",
12-
opacity: 1,
13-
visible: true,
14-
properties: () => ({}),
15-
};
14+
export const layersCommonDefaultProps: Options<Source> & LayerSwitcherOptions =
15+
{
16+
className: "ol-layer",
17+
opacity: 1,
18+
visible: true,
19+
properties: () => ({}),
20+
displayInLayerSwitcher: true,
21+
};
1622

1723
export function useDefaults<
1824
T extends LayersCommonProps<S>,

Diff for: src/components/layers/OlLayerGroup.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@ defineOptions({
3030
inheritAttrs: false,
3131
});
3232
33-
type Props = Options & LayerSwitcherOptions;
33+
type Props = Options &
34+
LayerSwitcherOptions & {
35+
openInLayerSwitcher?: boolean;
36+
};
3437
const props = withDefaults(defineProps<Props>(), {
3538
opacity: 1,
3639
visible: true,
3740
properties: () => ({}),
41+
displayInLayerSwitcher: true,
3842
});
3943
4044
type Emits = CommonEvents &

Diff for: src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ export type LayerSwitcherOptions = {
3131
name?: string;
3232
allwaysOnTop?: boolean; // typo in original code, see https://github.com/Viglino/ol-ext/issues/1128
3333
baseLayer?: boolean;
34+
displayInLayerSwitcher: boolean;
3435
};

0 commit comments

Comments
 (0)