Skip to content

Commit

Permalink
[storybook/layer-leaflet/maplibre] adding button that randomly change…
Browse files Browse the repository at this point in the history
… the width of the sigma container
  • Loading branch information
sim51 committed Nov 19, 2024
1 parent 90141df commit 66c910e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export default () => {
getNodeLatLng: (attrs: Attributes) => ({ lat: attrs.latitude, lng: attrs.longitude }),
});

const widthBtn = document.getElementById("change-width") as HTMLButtonElement;
widthBtn.addEventListener("click", () => {
container.style.width = 50 + Math.random() * 50 + "%";
renderer.resize(true);
});

return () => {
renderer.kill();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
z-index: 500;
}
</style>
<div id="sigma-container"></div>
<div id="sigma-container">
<button id="change-width" style="z-index:999;position: absolute;">Change width</button>
</div>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export default () => {
getNodeLatLng: (attrs: Attributes) => ({ lat: attrs.latitude, lng: attrs.longitude }),
});

const widthBtn = document.getElementById("change-width") as HTMLButtonElement;
widthBtn.addEventListener("click", () => {
container.style.width = 50 + Math.random() * 50 + "%";
renderer.resize(true);
});

return () => {
renderer.kill();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
z-index: 500;
}
</style>
<div id="sigma-container"></div>
<div id="sigma-container">
<button id="change-width" style="z-index:999;position: absolute;">Change width</button>
</div>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" />

0 comments on commit 66c910e

Please sign in to comment.