Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit be2c67c

Browse files
committed
code comments
1 parent e5b6236 commit be2c67c

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

‎coordinate-calcite-js/index.html‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
});
7171
7272
const customWidget = document.createElement("div");
73+
// create the Calcite HTML
7374
customWidget.innerHTML = `
7475
<div class="custom-coordinate-conversion">
7576
@@ -96,7 +97,7 @@
9697
watch(
9798
() => vm.conversions.getItemAt(0)?.format,
9899
(format) => updateFormats(format),
99-
{ initial: true }
100+
{ initial: true } // initial: true will trigger the callback immediately
100101
);
101102
watch(
102103
() => vm.conversions.getItemAt(0)?.displayCoordinate,
@@ -120,10 +121,10 @@
120121
121122
coordinateSelect.addEventListener("calciteSelectChange", (event) => {
122123
const value = event.target.value;
123-
const format = vm.formats.find((format) => format.name === value);
124-
const newConversion = new Conversion({ format });
124+
const format = vm.formats.find((format) => format.name === value); // find new format
125+
const newConversion = new Conversion({ format }); // create new conversion
125126
vm.conversions.removeAt(0);
126-
vm.conversions.add(newConversion, 0);
127+
vm.conversions.add(newConversion, 0); // place conversion at the top
127128
});
128129
129130
coordinateMode.addEventListener("calciteSegmentedControlChange", (event) => {
@@ -132,21 +133,23 @@
132133
</calcite-accordion-item>
133134
<calcite-accordion-item heading="4. Capturing a point"
134135
description="Calling a ViewModel method and navigating to the returned point" icon-start="pin">
135-
<esri-demo-code language="js" source="coordinateEditable.addEventListener(
136+
<esri-demo-code language="js" source="// when inline editable is changed
137+
coordinateEditable.addEventListener(
136138
&quot;calciteInlineEditableEditConfirm&quot;,
137139
() =&gt; {
138140
reverseConvert();
139141
}
140142
);
141143
144+
// convert string coordinate to map point
142145
async function reverseConvert() {
143146
coordinateEditable.editingEnabled = false;
144147
const value = coordinateInput.value;
145148
try {
146149
const point = await vm.reverseConvert(value, activeFormat);
147150
vm.view.goTo(point);
148151
} catch (e) {
149-
coordinateInput.status = &quot;invalid&quot;;
152+
coordinateInput.status = &quot;invalid&quot;; // set inline editable to invalid
150153
}
151154
}"></esri-demo-code>
152155
</calcite-accordion-item>

‎coordinate-fluent-react-js/index.html‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
import { useMapView } from &quot;./hooks/useMapView&quot;;
5757
import { useCoordinateConversionVM } from &quot;./hooks/useCoordinateConversionVM&quot;;
5858
59-
// component to handle the Fluent UI coordinate conversion
59+
// new Fluent UI coordinate component being created
6060
import FluentCoordinateConversion from &quot;./components/FluentCoordinateConversion&quot;;
6161
6262
function App() {
@@ -96,6 +96,7 @@
9696
9797
useEffect(() =&gt; {
9898
const handle = watch(
99+
// watch the displayCoordinate property on the first conversion
99100
() =&gt; vm?.conversions?.getItemAt(0)?.displayCoordinate,
100101
(displayCoordinate) =&gt;
101102
setActiveDisplayCoordinate(displayCoordinate ?? &quot;&quot;),

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /