@@ -37,7 +37,7 @@ const customWidget = document.createElement("div");
37
37
customWidget . innerHTML = `
38
38
<div class="custom-coordinate-conversion">
39
39
<calcite-segmented-control id="custom-coordinate-mode">
40
- <calcite-segmented-control-item icon-start="selection-x " value="live" checked>Live</calcite-segmented-control-item>
40
+ <calcite-segmented-control-item icon-start="cursor " value="live" checked>Live</calcite-segmented-control-item>
41
41
<calcite-segmented-control-item icon-start="pin" value="capture">Capture</calcite-segmented-control-item>
42
42
</calcite-segmented-control>
43
43
<calcite-select id="custom-coordinate-select"></calcite-select>
@@ -85,8 +85,13 @@ coordinateMode.addEventListener("calciteSegmentedControlChange", (event) => {
85
85
async function reverseConvert ( ) {
86
86
coordinateEditable . editingEnabled = false ;
87
87
const value = coordinateInput . value ;
88
- const point = await vm . reverseConvert ( value , activeFormat ) ; // todo: catch this, add status
89
- view . goTo ( point ) ;
88
+ try {
89
+ const point = await vm . reverseConvert ( value , activeFormat ) ;
90
+ view . goTo ( point ) ;
91
+ } catch ( e ) {
92
+ coordinateInput . status = "invalid" ;
93
+ coordinateInput . validationMessage = "Invalid coordinate" ;
94
+ }
90
95
}
91
96
92
97
coordinateEditable . addEventListener ( "calciteInlineEditableEditConfirm" , ( ) => {
@@ -117,4 +122,5 @@ function updateFormats(currentFormat) {
117
122
118
123
function updateCoordinates ( activeDisplayCoordinate ) {
119
124
coordinateInput . value = activeDisplayCoordinate ;
125
+ coordinateInput . status = "valid" ;
120
126
}
0 commit comments