UNPKG

1.61 kBTypeScriptView Raw
1// Type definitions for @timohausmann/quadtree-js v1.2.5
2// https://github.com/timohausmann/quadtree-js
3// Definitions by: Timo Hausmann <https://timohausmann.de/>
4// Template: https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-class-d-ts.html
5
6/*~ If this module is a UMD module that exposes a global variable 'myClassLib' when
7 *~ loaded outside a module loader environment, declare that global here.
8 */
9export as namespace Quadtree;
10
11/*~ This declaration specifies that the class constructor function
12 *~ is the exported object from the file
13 */
14export = Quadtree;
15
16/*~ Write your module's methods and properties in this class */
17declare class Quadtree {
18 constructor (bounds: Quadtree.Rect, max_objects?: number, max_levels?: number, level?: number);
19 max_objects: number;
20 max_levels: number;
21 level: number;
22 bounds: Quadtree.Rect;
23 objects: Quadtree.Rect[];
24 nodes: Quadtree[];
25
26 split(): void
27 getIndex(pRect: Quadtree.Rect): number[]
28 insert(pRect: Quadtree.Rect): void
29 retrieve<T extends Quadtree.Rect>(pRect: Quadtree.Rect): T[]
30 clear(): void
31}
32
33/*~ If you want to expose types from your module as well, you can
34 *~ place them in this block.
35 *~
36 *~ Note that if you decide to include this namespace, the module can be
37 *~ incorrectly imported as a namespace object, unless
38 *~ --esModuleInterop is turned on:
39 *~ import * as x from '[~THE MODULE~]'; // WRONG! DO NOT DO THIS!
40 */
41declare namespace Quadtree {
42 export interface Rect {
43 x: number
44 y: number
45 width: number
46 height: number
47 }
48}
\No newline at end of file