Skip to content

Commit

Permalink
chore(docs): add some more information about layer config
Browse files Browse the repository at this point in the history
  • Loading branch information
silvester-pari committed Nov 21, 2023
1 parent 3f28517 commit 4c0c681
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
55 changes: 28 additions & 27 deletions elements/layercontrol/layercontrol.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export const ExpandedLayers = {
export const Tools = {
args: {},
render: () => html`
<p>Default tools: info, opacity, remove, sort</p>
<p>Default tools: info, opacity, config, remove, sort</p>
<eox-layercontrol for="eox-map#tools"></eox-layercontrol>
<hr />
<p>Only one tool: info</p>
Expand Down Expand Up @@ -365,8 +365,9 @@ export const Tools = {
};

/**
* The layer control accepts a "tools" array, which enable
* extra functionalities for layers
* The "config" tool reads settings passed via the "layerConfig" property,
* e.g. rendering a from from a provided JSON schema that allows updating the
* source url parameters.
*/
export const LayerConfig = {
args: {},
Expand All @@ -387,32 +388,32 @@ export const LayerConfig = {
properties: {
id: "customId",
title: "Tile XYZ",
},
layerConfig: {
schema: {
type: "object",
properties: {
vminmax: {
type: "object",
properties: {
vmin: {
type: "number",
minimum: 0,
maximum: 10,
format: "range",
},
vmax: {
type: "number",
minimum: 0,
maximum: 10,
format: "range",
layerConfig: {
schema: {
type: "object",
properties: {
vminmax: {
type: "object",
properties: {
vmin: {
type: "number",
minimum: 0,
maximum: 10,
format: "range",
},
vmax: {
type: "number",
minimum: 0,
maximum: 10,
format: "range",
},
},
format: "minmax",
},
cbar: {
type: "string",
enum: ["rain", "temperature"],
},
format: "minmax",
},
cbar: {
type: "string",
enum: ["rain", "temperature"],
},
},
},
Expand Down
5 changes: 4 additions & 1 deletion elements/layercontrol/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ import { filterLayers } from "./helpers";
* #### `layerControlToolsExpand?: Boolean`
* Pre-expand the layer tools so they are visible when the component initializes.
*
* #### `layerConfig?: Object`
* Configuration options for the layer (displayed in the layer tools' "config" tab)
*
* @element eox-layercontrol
*/
export class EOxLayerControl extends LitElement {
Expand Down Expand Up @@ -78,7 +81,7 @@ export class EOxLayerControl extends LitElement {
/**
* Layer tools
*/
this.tools = ["info", "opacity", "remove", "sort"];
this.tools = ["info", "opacity", "config", "remove", "sort"];

/**
* Render the element without additional styles
Expand Down

0 comments on commit 4c0c681

Please sign in to comment.