Skip to content

Commit

Permalink
formatting code with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed May 15, 2024
1 parent b9b7f60 commit 9f03fc6
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 18 deletions.
10 changes: 5 additions & 5 deletions src/WebARKitCV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ export class WebARKitCV implements WebARKitCVBuilder {
*/
public addTrackable(
trackableName: string,
trackableUrl: string
trackableUrl: string,
): WebARKitCVBuilder {
if (typeof trackableName === "string" && typeof trackableUrl === "string") {
this.webarkit!.trackable!.name = trackableName;
this.webarkit!.trackable!.url = trackableUrl;
this.webarkit!.trackable!.uuid = uuidv4();
this.webarkit!.trackables?.set(
this.trackableCount++,
this.webarkit!.trackable!
this.webarkit!.trackable!,
);
} else {
throw new Error("Trackable name and url must be strings");
Expand All @@ -104,8 +104,8 @@ export class WebARKitCV implements WebARKitCVBuilder {
this.webarkit.height,
data!.width,
data!.height,
data
)
data,
),
);
this.webarkit.trackers?.set(index, {
name: trackable.name,
Expand Down Expand Up @@ -141,7 +141,7 @@ export class WebARKitCV implements WebARKitCVBuilder {

public async track(
trackers: Map<number, ITracker>,
imgData: ImageData
imgData: ImageData,
): Promise<Map<number, ITracker>> {
console.info("Start tracking!");
try {
Expand Down
4 changes: 2 additions & 2 deletions src/Workers/WebARKitCVWorkers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export abstract class AbstractWebARKitCVWorker {
constructor(
trackables: Map<number, ITrackable>,
width: number,
height: number
height: number,
) {
this.trackables = trackables;
this.vw = width;
Expand All @@ -31,7 +31,7 @@ export class WebARKitCVOrbWorker extends AbstractWebARKitCVWorker {
vheight: number,
twidth: number,
theight: number,
data: any
data: any,
) {
super(trackables, vwidth, vheight);
this.data = data;
Expand Down
2 changes: 1 addition & 1 deletion src/Workers/Worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const loadTrackables = async (msg: any) => {
mat,
noArray,
template_keypoints_vector,
template_descriptors
template_descriptors,
);

var cornersArray = new Float64Array(8);
Expand Down
6 changes: 5 additions & 1 deletion src/interfaces/Trackables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ export interface ITrackable {
* @property {string} uuid - The uuid of the trackable.
*/
export class Trackable implements ITrackable {
constructor(public url: string, public name: string, public uuid: string) {}
constructor(
public url: string,
public name: string,
public uuid: string,
) {}
}
2 changes: 1 addition & 1 deletion src/interfaces/Trackers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export class Tracker implements ITracker {
constructor(
public name: string,
public matrix: Float32Array,
public uuid: string
public uuid: string,
) {}
}
2 changes: 1 addition & 1 deletion src/interfaces/WebARKitCVBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class WebARKitBase {
public trackable?: ITrackable,
public trackables?: Map<number, ITrackable>,
public trackers?: Map<number, ITracker>,
public isLoaded?: boolean
public isLoaded?: boolean,
) {}
}

Expand Down
10 changes: 5 additions & 5 deletions src/io/CameraViewRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ export class CameraViewRenderer implements ICameraViewRenderer {
this.ox,
this.oy,
this.w,
this.h
this.h,
);
const imageData = this.context_process.getImageData(
0,
0,
this.pw,
this.ph
this.ph,
);
if (this.imageDataCache == null) {
this.imageDataCache = imageData.data;
Expand All @@ -163,15 +163,15 @@ export class CameraViewRenderer implements ICameraViewRenderer {
this.ox,
this.oy,
this.w,
this.h
this.h,
);
console.log(this.context_process);

const imageData = this.context_process.getImageData(
0,
0,
this.pw,
this.ph
this.ph,
);
if (this.imageDataCache == null) {
this.imageDataCache = imageData.data;
Expand Down Expand Up @@ -251,7 +251,7 @@ export class CameraViewRenderer implements ICameraViewRenderer {
}
} else {
return Promise.reject(
"Sorry, Your device does not support this experience."
"Sorry, Your device does not support this experience.",
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/WebARKitCVBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ class WebARKitCV implements WebARKitCVBuilder {

public addTrackable(
trackableName: string,
trackableUrl: string
trackableUrl: string,
): WebARKitCVBuilder {
if (typeof trackableName === "string" && typeof trackableUrl === "string") {
this.webarkit!.trackable!.name = trackableName;
this.webarkit!.trackable!.url = trackableUrl;
this.webarkit!.trackable!.uuid = uuidv4();
this.webarkit!.trackables?.set(
this.trackableCount++,
this.webarkit!.trackable!
this.webarkit!.trackable!,
);
} else {
throw new Error("Trackable name and url must be strings");
Expand Down

0 comments on commit 9f03fc6

Please sign in to comment.