Skip to content

Commit

Permalink
Use prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed May 14, 2024
1 parent d56226f commit 378a6db
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 19 deletions.
16 changes: 16 additions & 0 deletions route-snapper-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion route-snapper-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
"scripts": {
"tsc": "tsc -p tsconfig.json",
"prepublishOnly": "npm run tsc",
"prepare": "npm run prepublishOnly"
"prepare": "npm run prepublishOnly",
"fmt": "prettier --write ."
},
"devDependencies": {
"@types/geojson": "^7946.0.14",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
},
"dependencies": {
Expand Down
32 changes: 17 additions & 15 deletions route-snapper-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,39 @@ import { JsRouteSnapper } from "route-snapper";
const snapDistancePixels = 30;

interface Writable<T> {
set(value: T): void;
set(value: T): void;
}

// TODO This isn't complete
export interface Props {
waypoints: Waypoint[];
waypoints: Waypoint[];
}

export interface Waypoint {
lon: number;
lat: number;
snapped: boolean;
lon: number;
lat: number;
snapped: boolean;
}

export class RouteTool {
map: Map;
inner: JsRouteSnapper;
active: boolean;
eventListenersSuccess: ((
f: Feature<LineString | Polygon, Props>,
) => void)[];
eventListenersUpdated: ((
f: Feature<LineString | Polygon, Props>,
) => void)[];
eventListenersSuccess: ((f: Feature<LineString | Polygon, Props>) => void)[];
eventListenersUpdated: ((f: Feature<LineString | Polygon, Props>) => void)[];
eventListenersFailure: (() => void)[];

routeToolGj: Writable<GeoJSON>;
snapMode: Writable<boolean>;
undoLength: Writable<number>;

constructor(map: Map, graphBytes: Uint8Array, routeToolGj: Writable<GeoJSON>, snapMode: Writable<boolean>, undoLength: Writable<number>) {
constructor(
map: Map,
graphBytes: Uint8Array,
routeToolGj: Writable<GeoJSON>,
snapMode: Writable<boolean>,
undoLength: Writable<number>,
) {
this.map = map;
console.time("Deserialize and setup JsRouteSnapper");
this.inner = new JsRouteSnapper(graphBytes);
Expand All @@ -45,9 +47,9 @@ export class RouteTool {
this.eventListenersUpdated = [];
this.eventListenersFailure = [];

this.routeToolGj = routeToolGj;
this.snapMode = snapMode;
this.undoLength = undoLength;
this.routeToolGj = routeToolGj;
this.snapMode = snapMode;
this.undoLength = undoLength;

this.map.on("mousemove", this.onMouseMove);
this.map.on("click", this.onClick);
Expand Down
4 changes: 1 addition & 3 deletions route-snapper-ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
"outDir": "./dist",
"declaration": true
},
"include": [
"./src"
]
"include": ["./src"]
}

0 comments on commit 378a6db

Please sign in to comment.