Measurement Events
MeasurementStarted
The MeasurementStarted event is triggered when a user initiates a measurement on a Dashboard or Record Level Maptaskr Map. This event provides information about the measurement type and the starting latitude and longitude coordinates.
Parameters:
measurementType(string): The type of measurement.startLat(number): Latitude where measurement started.startLng(number): Longitude where measurement started.
Usage:
const control = globalThis.MaptaskrControlManager.getControl(controlId);
control.on("MeasurementStarted", (measurementType, startLat, startLng) => {
  console.log(measurementType, startLat, startLng);
});
Response
{
	"measurementType": "Length",
	"startLat": -26.419799279999758,
	"startLng": 120.8524177741142
}
Removing Event Listeners:
control.off("MeasurementStarted");
MeasurementCompleted
The MeasurementCompleted event is triggered when a user completes a measurement on a Dashboard or Record Level Maptaskr Map. This event provides information about the measurement type, finishing latitude, finishing longitude, a polygon representation (if applicable), and any associated measurement text.
Parameters:
measurementType(string): The type of measurement (e.g., distance, area).finishLat(number): Latitude where measurement finished.finishLong(number): Longitude where measurement finished.polygon(object): The measured polygon (if applicable).measurementText(string): The measurement result as text.
Usage:
control.on("MeasurementCompleted", (measurementType, finishLat, finishLong, polygon, measurementText) => {
  console.log(measurementType, finishLat, finishLong, polygon, measurementText);
});
Response
{
	"measurementType":"Length",
	"finishLat": -25.04421382387953,
	"finishLong":143.87664568314688, 
	"polygon":{"type":"LineString","coordinates":[[134.84163640850568,-20.218539841815826],[143.87664568314688,-25.04421382387953]]}
	"measurementText": "1072.07 km"
}
Removing Event Listeners:
control.off("MeasurementCompleted");
MeasurementsCleared
The MeasurementsCleared event is triggered when a user clears all measurements on a Dashboard or Record Level Maptaskr Map. This event indicates the completion of measurement deletion.
Parameters: None.
Usage:
const control = globalThis.MaptaskrControlManager.getControl(controlId);
control.on("MeasurementsCleared", () => {
  console.log('Measurement cleared');
});
Removing Event Listeners:
control.off("MeasurementsCleared");
MeasurementCancelled
The MeasurementCancelled event is triggered when a user cancels a measurement on a Dashboard or Record Level Maptaskr Map. This event provides information about the measurement type that was cancelled.
Parameters:
measurementType(string): The type of measurement cancelled.
Usage:
const control = globalThis.MaptaskrControlManager.getControl(controlId);
control.on("MeasurementCancelled", (measurementType) => {
  console.log(measurementType);
});
Response
{
	"measurementType":"Length"
}
Removing Event Listeners:
control.off("MeasurementCancelled");