Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(terra-draw): correct spelling mistakes across codebase #463

Merged
merged 3 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ npm run test:headed

## Tests

Tests are located in the `tests` folder. You will see the `leaflet.spec.ts` file, this is where the tests are kept for the E2E tests written for the Leaflet Adapter. There are also some convienence methods written in the `setup.ts` file which can be leveraged to write tests more easily.
Tests are located in the `tests` folder. You will see the `leaflet.spec.ts` file, this is where the tests are kept for the E2E tests written for the Leaflet Adapter. There are also some convenience methods written in the `setup.ts` file which can be leveraged to write tests more easily.
6 changes: 3 additions & 3 deletions packages/e2e/tests/leaflet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ test.describe("sensor mode", () => {
await page.mouse.move(mapDiv.width / 3, mapDiv.height / 3, { steps: 30 });
await page.mouse.click(mapDiv.width / 3, mapDiv.height / 3);

// The cursor is now behind the initial arc and so wont close the sensor
// The cursor is now behind the initial arc and so won't close the sensor
await page.mouse.move(mapDiv.width / 1, mapDiv.height / 3, { steps: 30 });
await page.mouse.click(mapDiv.width / 1, mapDiv.height / 3);

Expand Down Expand Up @@ -1123,7 +1123,7 @@ test.describe("select mode", () => {
// Deselect
await page.mouse.click(mapDiv.width - 10, mapDiv.height / 2);

// We are attempting to dragg right tothe top left corner but it is not getting there
// We are attempting to dragg right to the top left corner but it is not getting there
// because it is capped by the validation. If this was allowed x would be ~90
await expectGroupPosition({ page, x: 553, y: 273 });
});
Expand Down Expand Up @@ -1168,7 +1168,7 @@ test.describe("select mode", () => {
// Deselect
await page.mouse.click(mapDiv.width - 10, mapDiv.height / 2);

// We are attempting to dragg right tothe top left corner but it is not getting there
// We are attempting to dragg right to the top left corner but it is not getting there
// because it is capped by the validation. If this was allowed x would be ~90
await expectGroupPosition({ page, x: 563, y: 301 });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ describe("TerraDrawGoogleMapsAdapter", () => {
});

describe("getLngLatFromEvent", () => {
it("returns null for unitialized map", () => {
it("returns null for uninitialized map", () => {
const mapMock = createMockGoogleMap();
const adapter = new TerraDrawGoogleMapsAdapter({
lib: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class TerraDrawGoogleMapsAdapter extends TerraDrawExtend.TerraDrawBaseAda
this._overlay = new this._lib.OverlayView();
this._overlay.draw = function () {};

// Unforunately it is only ready after the onAdd
// Unfortunately it is only ready after the onAdd
// method is called, which is why we need to use the 'ready'
// listener with the Google Maps adapter
this._overlay.onAdd = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class TerraDrawOpenLayersAdapter extends TerraDrawExtend.TerraDrawBaseAda

this._container = this._map.getViewport();

// TODO: Is this the best way to recieve keyboard events
// TODO: Is this the best way to receive keyboard events
this._container.setAttribute("tabindex", "0");

const vectorSource = new this._lib.VectorSource({
Expand Down Expand Up @@ -89,8 +89,8 @@ export class TerraDrawOpenLayersAdapter extends TerraDrawExtend.TerraDrawBaseAda
private _geoJSONReader: GeoJSON;

/**
* Converts a hexideciaml color to RGB
* @param hex a string of the hexidecimal string
* Converts a hexadecimal color to RGB
* @param hex a string of the hexadecimal string
* @returns an object to red green and blue (RGB) color
*/
private hexToRGB(hex: string): { r: number; g: number; b: number } {
Expand Down
4 changes: 2 additions & 2 deletions packages/terra-draw/src/common/base.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export abstract class TerraDrawBaseAdapter implements TerraDrawAdapter {
isMicroDrag =
pixelDistanceToCheck < this._minPixelDragDistanceDrawing;
} else if (modeState === "selecting") {
// Simiarly when selecting, we want to ignore very small pointer
// Similarly when selecting, we want to ignore very small pointer
// movements when holding the map down as these are normally done
// by accident when drawing and is not an intended drag
isMicroDrag =
Expand Down Expand Up @@ -318,7 +318,7 @@ export abstract class TerraDrawBaseAdapter implements TerraDrawAdapter {
}

// Ensure we go back to the regular behaviour
// not dragging and re-enable draggin on the actual map
// not dragging and re-enable dragging on the actual map
this._dragState = "not-dragging";
this.setDraggability(true);
},
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-draw/src/geometry/measure/area.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Polygon } from "geojson";
import { earthRadius } from "../helpers";

// Adapted from @turf/area is MIT Licensed licesned https://github.com/Turfjs/turf/blob/master/packages/turf-area/index.ts
// Adapted from @turf/area is MIT Licensed licensed https://github.com/Turfjs/turf/blob/master/packages/turf-area/index.ts
// In turn adapted from NASA: https://dataverse.jpl.nasa.gov/file.xhtml?fileId=47998&version=2.0

export function polygonAreaSquareMeters(polygon: Polygon) {
Expand Down
4 changes: 2 additions & 2 deletions packages/terra-draw/src/geometry/transform/rotate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export function transformRotate(
// Use centroid of GeoJSON if pivot is not provided
const pivot = centroid(feature);

const cooordinates =
const coordinates =
feature.geometry.type === "Polygon"
? feature.geometry.coordinates[0]
: feature.geometry.coordinates;

cooordinates.forEach((pointCoords: Position) => {
coordinates.forEach((pointCoords: Position) => {
const initialAngle = rhumbBearing(pivot, pointCoords);
const finalAngle = initialAngle + angle;
const distance = rhumbDistance(pivot, pointCoords);
Expand Down
4 changes: 2 additions & 2 deletions packages/terra-draw/src/geometry/transform/scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export function transformScale(
return feature;
}

const cooordinates =
const coordinates =
feature.geometry.type === "Polygon"
? feature.geometry.coordinates[0]
: feature.geometry.coordinates;

cooordinates.forEach((pointCoords: Position) => {
coordinates.forEach((pointCoords: Position) => {
const originalDistance = rhumbDistance(origin, pointCoords);
const bearing = rhumbBearing(origin, pointCoords);
const newDistance = originalDistance * factor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class TerraDrawAngledRectangleMode extends TerraDrawBaseDrawMode<PolygonS
// We want pointer devices (mobile/tablet) to have
// similar behaviour to mouse based devices so we
// trigger a mousemove event before every click
// if one has not been trigged to emulate this
// if one has not been triggered to emulate this
if (this.currentCoordinate > 0 && !this.mouseMove) {
this.onMouseMove(event);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/terra-draw/src/modes/freehand/freehand.mode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe("TerraDrawFreehandMode", () => {

freehandMode.onClick(MockCursorEvent({ lng: 0, lat: 0 }));

// Closing cooridnate should still exist
// Closing coordinate should still exist
features = store.copyAll();
expect(features.length).toBe(2);

Expand All @@ -216,7 +216,7 @@ describe("TerraDrawFreehandMode", () => {

freehandMode.onClick(MockCursorEvent({ lng: 0, lat: 0 }));

// Closing cooridnate should be removed
// Closing coordinate should be removed
features = store.copyAll();
expect(features.length).toBe(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineStringSty
// We want pointer devices (mobile/tablet) to have
// similar behaviour to mouse based devices so we
// trigger a mousemove event before every click
// if one has not been trigged to emulate this
// if one has not been triggered to emulate this
if (this.currentCoordinate > 0 && !this.mouseMove) {
this.onMouseMove(event);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-draw/src/modes/sector/sector.mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export class TerraDrawSectorMode extends TerraDrawBaseDrawMode<SectorPolygonStyl
// We want pointer devices (mobile/tablet) to have
// similar behaviour to mouse based devices so we
// trigger a mousemove event before every click
// if one has not been trigged to emulate this
// if one has not been triggered to emulate this
if (this.currentCoordinate > 0 && !this.mouseMove) {
this.onMouseMove(event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ export class DragCoordinateResizeBehavior extends TerraDrawModeBehavior {

const [west, south, east, north] = bbox;

// Bounding box is represnted as follows:
// Bounding box is represented as follows:
//
// 0 1 2
// *----*----*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class MidPointBehavior extends TerraDrawModeBehavior {
this.store.delete([...this._midPoints, ...this.selectionPointBehavior.ids]);

// We don't need to check if flags are correct
// because selection points are prerequiste for midpoints
// because selection points are prerequisite for midpoints
this.create(
updatedCoordinates,
midPointFeatureId as string,
Expand Down
4 changes: 2 additions & 2 deletions packages/terra-draw/src/modes/select/select.mode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ describe("TerraDrawSelectMode", () => {
expect(store.updateGeometry).toHaveBeenCalledTimes(0);
});

it("deletes a coordinate in deleteable set to true and a coordinate is clicked on", () => {
it("deletes a coordinate in deletable set to true and a coordinate is clicked on", () => {
setSelectMode({
flags: {
polygon: {
Expand Down Expand Up @@ -1108,7 +1108,7 @@ describe("TerraDrawSelectMode", () => {

selectMode.onClick(MockCursorEvent({ lng: 0, lat: 0 }));

// Pointer set to move when teh cursor is
// Pointer set to move when the cursor is
expect(setCursor).toHaveBeenCalledTimes(1);
expect(setCursor).toHaveBeenCalledWith("move");

Expand Down
4 changes: 2 additions & 2 deletions packages/terra-draw/src/modes/sensor/sensor.mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export class TerraDrawSensorMode extends TerraDrawBaseDrawMode<SensorPolygonStyl
return;
}

// This shouldn't happen but we protect against it incase as we can't calculate if the cursor
// This shouldn't happen but we protect against it in case as we can't calculate if the cursor
// is in the sector otherwise
if (!this.direction) {
return;
Expand Down Expand Up @@ -490,7 +490,7 @@ export class TerraDrawSensorMode extends TerraDrawBaseDrawMode<SensorPolygonStyl
// We want pointer devices (mobile/tablet) to have
// similar behaviour to mouse based devices so we
// trigger a mousemove event before every click
// if one has not been trigged to emulate this
// if one has not been triggered to emulate this
if (this.currentCoordinate > 0 && !this.mouseMove) {
this.onMouseMove(event);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-draw/src/store/store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe("GeoJSONStore", () => {
});

describe("has", () => {
it("returns false for non exisiting store feature", () => {
it("returns false for non existing store feature", () => {
const store = new GeoJSONStore();

expect(store.has("e3ccd3b9-afb1-4f0b-91d8-22a768d5f284")).toBe(false);
Expand Down
Loading