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

Add strict TypeScript checks #15

Merged
merged 1 commit into from
Feb 23, 2019
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
4 changes: 2 additions & 2 deletions dist/ARBaseControls.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EventDispatcher } from "three";
import { EventDispatcher, Object3D } from "three";
export declare class ARBaseControls extends EventDispatcher {
static id: number;
protected id: number;
protected object3d: any;
constructor(object3d: any);
constructor(object3d: Object3D);
update(targetObject3d?: any): void;
name(): void;
}
Expand Down
6 changes: 3 additions & 3 deletions dist/ARCameraParam.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
* @param {string} onerror Error callback to called when things don't work out.
*/
export declare class ARCameraParam {
complete: boolean;
private id;
private _src;
private complete;
private onload;
private onerror;
constructor(src: any, onload: any, onerror: any);
constructor(src: string, onload: () => any, onerror: (error: any) => any);
/**
* Loads the given URL as camera parameters definition file into this ARCameraParam.
* Can only be called on an unloaded ARCameraParam instance.
* @param {string} src URL to load.
*/
load(src: any): void;
load(src: string): void;
src: string;
/**
* Destroys the camera parameter and frees associated Emscripten resources.
Expand Down
10 changes: 6 additions & 4 deletions dist/ARContext.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import * as THREE from "three";
import { ARMarkerControls } from "./ARMarkerControls";
export declare class ARContext extends THREE.EventDispatcher {
initialized: boolean;
private parameters;
private arController;
private _arMarkerControls;
private _updatedAt;
private initialized;
private _artoolkitProjectionAxisTransformMatrix;
private contextError;
constructor(parameters: any);
setParameters(parameters: any): void;
init(onCompleted: () => void): void;
update(srcElement: any): boolean;
addMarker(arMarkerControls: any): void;
removeMarker(arMarkerControls: any): void;
_initArtoolkit(onCompleted: any): this;
addMarker(arMarkerControls: ARMarkerControls): void;
removeMarker(arMarkerControls: ARMarkerControls): void;
_initArtoolkit(onCompleted: () => any): this;
getProjectionMatrix(srcElement: any): THREE.Matrix4;
private _updateArtoolkit;
}
Expand Down
54 changes: 27 additions & 27 deletions dist/ARController.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@
* ARCameraParam definition file, calling ARController#onload on success.
*/
export declare class ARController {
ctx: CanvasRenderingContext2D;
ctx: CanvasRenderingContext2D | null;
canvas: HTMLCanvasElement;
videoWidth: any;
videoHeight: any;
orientation: string;
private framepointer;
private id;
private orientation;
private listeners;
private image;
private defaultMarkerWidget;
private patternMarkers;
private barcodeMarkers;
private transformMat;
private defaultMarkerWidth;
private videoWidth;
private videoHeight;
private cameraParam;
private markerTransformMat;
private _bwpointer;
private framesize;
private dataHeap;
private cameraMat;
private onload;
private contextError;
constructor(width: any, height: any, camera: any);
/**
* Destroys the ARController instance and frees all associated resources.
Expand Down Expand Up @@ -80,7 +80,7 @@ export declare class ARController {
* If the debugSetup has been called, draws debug markers on the debug canvas.
* @param {HTMLImageElement|HTMLVideoElement} [image] The image to process [optional].
*/
process(image: any): void;
process(image: HTMLImageElement | HTMLVideoElement): void;
/**
* Adds the given pattern marker ID to the index of tracked IDs.
* Sets the markerWidth for the pattern marker to markerWidth.
Expand Down Expand Up @@ -113,7 +113,7 @@ export declare class ARController {
* @param {number} multiMarkerId The id number of the multimarker to access. Given by loadMultiMarker.
* @return {number} Number of markers in the multimarker. Negative value indicates failure to find the multimarker.
*/
getMultiMarkerPatternCount(multiMarkerId: any): any;
getMultiMarkerPatternCount(multiMarkerId: number): any;
/**
* Add an event listener on this ARController for the named event, calling the callback function
* whenever that event is dispatched.
Expand All @@ -126,13 +126,13 @@ export declare class ARController {
* @param {string} name Name of the event to listen to.
* @param {function} callback Callback function to call when an event with the given name is dispatched.
*/
addEventListener(name: any, callback: any): void;
addEventListener(name: string, callback: (event: any) => any): void;
/**
* Remove an event listener from the named event.
* @param {string} name Name of the event to stop listening to.
* @param {function} callback Callback function to remove from the listeners of the named event.
*/
removeEventListener(name: any, callback: any): void;
removeEventListener(name: string, callback: () => any): void;
/**
* Dispatches the given event to all registered listeners on event.name.
* @param {Object} event Event to dispatch.
Expand All @@ -150,7 +150,7 @@ export declare class ARController {
* @param {function} onSuccess - The success callback. Called with the id of the loaded marker on a successful load.
* @param {function} onError - The error callback. Called with the encountered error if the load fails.
*/
loadMarker(markerURL: any, onSuccess: any, onError: any): void;
loadMarker(markerURL: string, onSuccess: (id: number) => any, onError: (err: any) => any): void;
/**
* Loads a multimarker from the given URL and calls the onSuccess callback with the UID of the marker.
* arController.loadMultiMarker(markerURL, onSuccess, onError);
Expand All @@ -159,7 +159,7 @@ export declare class ARController {
* number of sub-markers of the loaded marker on a successful load.
* @param {function} onError - The error callback. Called with the encountered error if the load fails.
*/
loadMultiMarker(markerURL: any, onSuccess: any, onError: any): void;
loadMultiMarker(markerURL: string, onSuccess: () => any, onError: () => any): void;
/**
* Populates the provided float array with the current transformation for the specified marker. After
* a call to detectMarker, all marker information will be current. Marker transformations can then be
Expand All @@ -169,7 +169,7 @@ export declare class ARController {
* @param {Float64Array} dst The float array to populate with the 3x4 marker transformation matrix
* @return {Float64Array} The dst array.
*/
getTransMatSquare(markerUID: any, markerWidth: any, dst: any): any;
getTransMatSquare(markerUID: number, markerWidth: number, dst: Float64Array): Float64Array;
/**
* Populates the provided float array with the current transformation for the specified marker, using
* previousMarkerTransform as the previously detected transformation. After
Expand All @@ -182,7 +182,7 @@ export declare class ARController {
* @param {Float64Array} dst The float array to populate with the 3x4 marker transformation matrix
* @return {Float64Array} The dst array.
*/
getTransMatSquareCont(markerUID: any, markerWidth: any, previousMarkerTransform: any, dst: any): any;
getTransMatSquareCont(markerUID: number, markerWidth: number, previousMarkerTransform: Float64Array, dst: Float64Array): Float64Array;
/**
* Populates the provided float array with the current transformation for the specified multimarker. After
* a call to detectMarker, all marker information will be current. Marker transformations can then be
Expand All @@ -192,7 +192,7 @@ export declare class ARController {
* @param {Float64Array} dst The float array to populate with the 3x4 marker transformation matrix
* @return {Float64Array} The dst array.
*/
getTransMatMultiSquare(markerUID: any, dst: any): any;
getTransMatMultiSquare(markerUID: number, dst: Float64Array): Float64Array;
/**
* Populates the provided float array with the current robust transformation for the specified multimarker. After
* a call to detectMarker, all marker information will be current. Marker transformations can then be
Expand All @@ -201,7 +201,7 @@ export declare class ARController {
* @param {Float64Array} dst The float array to populate with the 3x4 marker transformation matrix
* @return {Float64Array} The dst array.
*/
getTransMatMultiSquareRobust(markerUID: any, dst: any): any;
getTransMatMultiSquareRobust(markerUID: number, dst: Float64Array): Float64Array;
/**
* Converts the given 3x4 marker transformation matrix in the 12-element transMat array
* into a 4x4 WebGL matrix and writes the result into the 16-element glMat array.
Expand All @@ -224,7 +224,7 @@ export declare class ARController {
* @return {number} 0 if the function proceeded without error, or a value less than 0 in case of error.
* A result of 0 does not however, imply any markers were detected.
*/
detectMarker(image: any): any;
detectMarker(imageElement: HTMLImageElement | HTMLVideoElement): any;
/**
* Get the number of markers detected in a video frame.
* @return {number} The number of detected markers in the most recent image passed to arDetectMarker.
Expand Down Expand Up @@ -272,7 +272,7 @@ export declare class ARController {
* @param {number} markerIndex The index of the marker to query.
* @returns {Object} The markerInfo struct.
*/
getMarker(markerIndex: any): any;
getMarker(markerIndex: number): any;
/**
* Set marker vertices to the given vertexData[4][2] array.
* Sets the marker pos to the center of the vertices.
Expand All @@ -281,7 +281,7 @@ export declare class ARController {
* @param {number} markerIndex The index of the marker to edit.
* @param {*} vertexData
*/
setMarkerInfoVertex(markerIndex: any, vertexData: any): any;
setMarkerInfoVertex(markerIndex: number, vertexData: any): any;
/**
* Makes a deep copy of the given marker info.
* @param {Object} markerInfo The marker info object to copy.
Expand All @@ -303,7 +303,7 @@ export declare class ARController {
* @param {number} markerIndex The index of the marker to query.
* @returns {Object} The markerInfo struct.
*/
getMultiEachMarker(multiMarkerId: any, markerIndex: any): any;
getMultiEachMarker(multiMarkerId: number, markerIndex: number): any;
/**
* Returns the 16-element WebGL transformation matrix used by ARController.process to
* pass marker WebGL matrices to event listeners.
Expand All @@ -316,21 +316,21 @@ export declare class ARController {
*
* @return {Float64Array} The 16-element WebGL camera matrix for the ARController camera parameters.
*/
getCameraMatrix(): any;
getCameraMatrix(): Float64Array;
/**
* Returns the shared ARToolKit 3x4 marker transformation matrix, used for passing and receiving
* marker transforms to/from the Emscripten side.
* @return {Float64Array} The 12-element 3x4 row-major marker transformation matrix used by ARToolKit.
*/
getMarkerTransformationMatrix(): any;
getMarkerTransformationMatrix(): Float64Array;
/**
* Enables or disables debug mode in the tracker. When enabled, a black and white debug
* image is generated during marker detection. The debug image is useful for visualising
* the binarization process and choosing a threshold value.
* @param {boolean} mode true to enable debug mode, false to disable debug mode
* @see getDebugMode()
*/
setDebugMode(mode: any): any;
setDebugMode(mode: number): any;
/**
* Returns whether debug mode is currently enabled.
* @return {boolean} true when debug mode is enabled, false when debug mode is disabled
Expand Down Expand Up @@ -361,7 +361,7 @@ export declare class ARController {
* @param dir
* @returns {*}
*/
setMarkerInfoDir(markerIndex: any, dir: any): any;
setMarkerInfoDir(markerIndex: number, dir: any): any;
/**
* //TODOC
* @param value
Expand Down Expand Up @@ -421,7 +421,7 @@ export declare class ARController {
*
* @param {number} threshold An integer in the range [0,255] (inclusive).
*/
setThreshold(threshold: any): any;
setThreshold(threshold: number): any;
/**
* Get the current labeling threshold.
*
Expand Down Expand Up @@ -459,7 +459,7 @@ export declare class ARController {
* AR_TEMPLATE_MATCHING_MONO_AND_MATRIX
* The default mode is AR_TEMPLATE_MATCHING_COLOR.
*/
setPatternDetectionMode(mode: any): any;
setPatternDetectionMode(mode: number): any;
/**
* Returns the current pattern detection mode.
* @return {number} The current pattern detection mode.
Expand Down Expand Up @@ -520,12 +520,12 @@ export declare class ARController {
* If compatibility with ARToolKit verions 1.0 through 4.4 is required, this value
* must be 0.5.
*/
setPattRatio(pattRatio: any): any;
setPattRatio(pattRatio: number): any;
/**
* Returns the current ratio of the marker pattern to the total marker size.
* @return {number} The current pattern ratio.
*/
getPattRatio(): any;
getPattRatio(): number;
/**
* Set the image processing mode.
*
Expand Down
14 changes: 12 additions & 2 deletions dist/ARMarkerControls.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import { ARBaseControls } from "./ARBaseControls";
import { ARContext } from "./THREEAR";
import { Object3D } from "three";
interface ARMarkerControlsParameters {
size: number;
type: "pattern" | "barcode" | "unknown";
patternUrl: null | string;
barcodeValue: null | number;
changeMatrixMode: "modelViewMatrix" | "cameraTransformMatrix";
minConfidence: number;
[key: string]: any;
}
export declare class ARMarkerControls extends ARBaseControls {
private context;
private parameters;
constructor(context: ARContext, object3d: any, parameters: any);
setParameters(parameters: any): void;
constructor(context: ARContext, object3d: Object3D, parameters: ARMarkerControlsParameters);
setParameters(parameters: ARMarkerControlsParameters): void;
dispose(): void;
/**
* When you actually got a new modelViewMatrix, you need to perfom a whole bunch
Expand Down
16 changes: 13 additions & 3 deletions dist/ARSmoothedControls.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import ARBaseControls from "./ARBaseControls";
import { Object3D } from "three";
interface ARSmoothedControlsParameters {
lerpPosition?: number;
lerpQuaternion?: number;
lerpScale?: number;
lerpStepDelay?: number;
minVisibleDelay?: number;
minUnvisibleDelay?: number;
[key: string]: number | undefined;
}
export declare class ARSmoothedControls extends ARBaseControls {
private parameters;
private _lastLerpStepAt;
Expand All @@ -11,8 +21,8 @@ export declare class ARSmoothedControls extends ARBaseControls {
* @param {[type]} object3d [description]
* @param {[type]} parameters [description]
*/
constructor(object3d: any, parameters: any);
setParameters(parameters: any): void;
update(targetObject3d: any): void;
constructor(object3d: Object3D, parameters?: ARSmoothedControlsParameters);
setParameters(parameters: ARSmoothedControlsParameters): void;
update(targetObject3d: Object3D): void;
}
export default ARSmoothedControls;
24 changes: 17 additions & 7 deletions dist/ARSource.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
interface ARSourceParameters {
sourceType: "webcam" | "image" | "video";
sourceUrl: null | string;
deviceId: any;
sourceWidth: number;
sourceHeight: number;
displayWidth: number;
displayHeight: number;
[key: string]: any;
}
export declare class ARSource {
private ready;
ready: boolean;
private domElement;
private parameters;
private currentTorchStatus;
constructor(parameters: any);
setParameters(parameters: any): void;
init(onReady: any, onError: any): this;
_initSourceImage(onReady: any): HTMLImageElement;
_initSourceVideo(onReady: any): HTMLVideoElement;
_initSourceWebcam(onReady: any, onError: any): HTMLVideoElement;
constructor(parameters: ARSourceParameters);
setParameters(parameters: ARSourceParameters): void;
init(onReady: () => any, onError: () => any): this;
_initSourceImage(onReady: () => any): HTMLImageElement;
_initSourceVideo(onReady: () => any): HTMLVideoElement;
_initSourceWebcam(onReady: () => any, onError: (err: any) => any): HTMLVideoElement;
hasMobileTorch(domElement: any): boolean;
/**
* toggle the flash/torch of the mobile fun if applicable.
Expand Down
Loading