Skip to content

Commit b045326

Browse files
author
Savina Shen (Manpower Services Taiwan Co Ltd)
committed
add image layer example
1 parent d6b9c05 commit b045326

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

src/stories/ImageLayer/ImageLayer.mdx

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { Meta, StoryObj } from '@storybook/react';
2+
import ImageLayer from './ImageLayer';
3+
4+
const meta: Meta<typeof ImageLayer> = {
5+
title: 'Image Layer',
6+
component: ImageLayer,
7+
parameters: {
8+
layout: 'centered',
9+
},
10+
};
11+
export default meta;
12+
13+
type Story = StoryObj<typeof ImageLayer>;
14+
15+
export const Example: Story = {};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { mapOptions } from '../../key';
2+
import { AzureMap, AzureMapsProvider, AzureMapDataSourceProvider, AzureMapLayerProvider } from 'react-azure-maps';
3+
import { LineLayerOptions } from 'azure-maps-control';
4+
import atlas from 'azure-maps-control';
5+
6+
const collection = new atlas.data.LineString([
7+
[-74.0039, 40.88029],
8+
[-87.583, 41.93497],
9+
[-105.20507, 39.77476],
10+
[-122.43164, 47.66538],
11+
]);
12+
13+
const ImageLayer = () => {
14+
return (
15+
<AzureMapsProvider>
16+
<div className="defaultMap sb-unstyled">
17+
<AzureMap options={{ ...mapOptions }}>
18+
{/* <AzureMapDataSourceProvider id="ImageLayer DataSourceProvider"> */}
19+
<AzureMapLayerProvider
20+
type="ImageLayer"
21+
options={{
22+
url: 'https://i.imgur.com/fc4Tw0H.jpg',
23+
// * An array of positions for the corners of the image listed in clockwise order: [top left, top right, bottom right, bottom left].
24+
coordinates: [
25+
[-130, 45],
26+
[-115, 45],
27+
[-115, 35],
28+
[-130, 35],
29+
],
30+
}}
31+
/>
32+
{/* </AzureMapDataSourceProvider> */}
33+
</AzureMap>
34+
</div>
35+
</AzureMapsProvider>
36+
);
37+
};
38+
39+
export default ImageLayer;

0 commit comments

Comments
 (0)