-
Notifications
You must be signed in to change notification settings - Fork 5
/
line-editor-dialog.tsx
49 lines (46 loc) · 1.21 KB
/
line-editor-dialog.tsx
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
import * as React from 'react'
import { geoEditorToDialog } from './geo-editor-to-dialog'
import { LINE } from 'geospatialdraw/bin/shapes/shape'
import CoordinateListEditor from './coordinate-list-editor'
import {
linePropsToGeo,
geoToLineProps,
} from 'geospatialdraw/bin/coordinates/geometry/polygon-line'
import Props from '../geo-editor-props'
/**
* Edits line geo
*/
const LineGeoEditor: React.SFC<Props> = ({
geo,
coordinateUnit,
onUpdateGeo,
}) => {
const { id, properties, coordinates, buffer, bufferUnit } = geoToLineProps(
geo
)
return (
<CoordinateListEditor
coordinateList={coordinates}
coordinateUnit={coordinateUnit}
buffer={buffer}
bufferUnit={bufferUnit}
onChange={(coordinatesValue, bufferValue, bufferUnitValue) => {
onUpdateGeo(
linePropsToGeo({
id,
coordinates: coordinatesValue,
buffer: bufferValue,
bufferUnit: bufferUnitValue,
properties,
})
)
}}
/>
)
}
/**
* Edits line geo in dialog
*/
const LineEditorDialog = geoEditorToDialog(LineGeoEditor, LINE)
LineEditorDialog.displayName = 'LineEditorDialog'
export { LineGeoEditor, LineEditorDialog }