forked from geostyler/geostyler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
60 lines (60 loc) · 1.68 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="./src/index.ts" crossorigin type="module"></script>
<link rel="stylesheet" src="./dist/style.css">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/antd.min.css"/>
</head>
<body>
<div id="root" ></div>
<div style="display: flex;">
<div id="preview" style="flex: 1;"></div>
<textarea id="textual_style" style="flex: 1; height: 300px;"></textarea>
</div>
<script defer type="module">
import { createRoot } from 'react-dom/client';
import React from 'react';
import { PreviewMap, Style } from './src/index';
const root = createRoot(
document.getElementById('root')
);
const preview = createRoot(
document.getElementById('preview')
);
let style = {
"name": "Demo Style",
"rules": [
{
"name": "Rule 1",
"symbolizers": [
{
"kind": "Mark",
"wellKnownName": "circle"
}
]
}
]
};
const renderPreview = () => {
const gsPreview = React.createElement(PreviewMap, {
style: style,
mapHeight: 300
});
preview.render(gsPreview);
};
const geostyler = React.createElement(Style, {
style: style,
onStyleChange: (gsStyle) => {
style = gsStyle;
document.getElementById('textual_style').value = JSON.stringify(style, null, 2);
renderPreview();
}
});
root.render(geostyler);
</script>
</body>
</html>