Skip to content

Commit 491218a

Browse files
committed
Update typings and docs
1 parent 69537ed commit 491218a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3970
-1689
lines changed

dist/files/Op.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export declare class Rectangle {
4747
}
4848
export declare class Circle {
4949
static fromRect(pts: GroupLike, enclose?: boolean): Group;
50+
static fromTriangle(pts: GroupLike, enclose?: boolean): Group;
5051
static fromCenter(pt: PtLike, radius: number): Group;
5152
static withinBound(pts: GroupLike, pt: PtLike, threshold?: number): boolean;
5253
static intersectRay2D(pts: GroupLike, ray: GroupLike): Group;

dist/files/Op.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files/Space.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files/Types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ export declare type IntersectContext = {
6767
edge: Group;
6868
other?: any;
6969
};
70-
export declare type UIHandler = (pt: Pt, target: UI, type: string) => void;
70+
export declare type UIHandler = (target: UI, pt: PtLike, type: string) => void;
7171
export declare type WarningType = "error" | "warn" | "mute";

dist/files/UI.d.ts

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,81 @@
1-
import { Pt, Group } from "./Pt";
2-
import { UIHandler } from "./Types";
3-
export declare enum UIShape {
4-
Rectangle = 0,
5-
Circle = 1,
6-
Polygon = 2,
7-
Polyline = 3,
8-
Line = 4
9-
}
1+
import { Group } from "./Pt";
2+
import { UIHandler, GroupLike, PtLike } from "./Types";
3+
export declare const UIShape: {
4+
rectangle: string;
5+
circle: string;
6+
polygon: string;
7+
polyline: string;
8+
line: string;
9+
};
1010
export declare const UIPointerActions: {
1111
up: string;
1212
down: string;
1313
move: string;
1414
drag: string;
15+
uidrag: string;
1516
drop: string;
1617
over: string;
1718
out: string;
19+
enter: string;
20+
leave: string;
21+
all: string;
1822
};
1923
export declare class UI {
20-
group: Group;
21-
shape: UIShape;
24+
_group: Group;
25+
_shape: string;
26+
protected static _counter: number;
2227
protected _id: string;
2328
protected _actions: {
24-
[key: string]: UIHandler;
29+
[key: string]: UIHandler[];
2530
};
2631
protected _states: {
2732
[key: string]: any;
2833
};
29-
constructor(group: Group, shape: UIShape, states: {}, id?: string);
34+
protected _holds: string[];
35+
constructor(group: GroupLike, shape: string, states?: {
36+
[key: string]: any;
37+
}, id?: string);
38+
static fromRectangle(group: GroupLike, states: {}, id?: string): UI;
39+
static fromCircle(group: GroupLike, states: {}, id?: string): UI;
40+
static fromPolygon(group: GroupLike, states: {}, id?: string): UI;
41+
static fromUI(ui: UI, states?: object, id?: string): UI;
3042
id: string;
31-
state(key: string): any;
32-
on(key: string, fn: UIHandler): this;
33-
off(key: string): this;
34-
listen(key: string, p: Pt): boolean;
43+
group: Group;
44+
shape: string;
45+
state(key: string, value?: any): any;
46+
on(key: string, fn: UIHandler): number;
47+
off(key: string, which?: number): boolean;
48+
listen(key: string, p: PtLike): boolean;
49+
protected hold(key: string): number;
50+
protected unhold(id?: number): void;
51+
static track(uis: UI[], key: string, p: PtLike): void;
3552
render(fn: (group: Group, states: {
3653
[key: string]: any;
3754
}) => void): void;
38-
protected _trigger(p: Pt): boolean;
55+
toString(): string;
56+
protected _within(p: PtLike): boolean;
57+
protected static _trigger(fns: UIHandler[], target: UI, pt: PtLike, type: string): void;
58+
protected static _addHandler(fns: UIHandler[], fn: UIHandler): number;
59+
protected static _removeHandler(fns: UIHandler[], index: number): boolean;
3960
}
4061
export declare class UIButton extends UI {
41-
_clicks: number;
42-
constructor(group: Group, shape: UIShape, states: {}, id?: string);
43-
readonly clicks: number;
44-
onClick(fn: UIHandler): void;
45-
onHover(over: UIHandler, out: UIHandler): void;
62+
private _hoverID;
63+
constructor(group: GroupLike, shape: string, states?: {
64+
[key: string]: any;
65+
}, id?: string);
66+
onClick(fn: UIHandler): number;
67+
offClick(id: number): boolean;
68+
onHover(enter?: UIHandler, leave?: UIHandler): number[];
69+
offHover(enterID?: number, leaveID?: number): boolean[];
70+
}
71+
export declare class UIDragger extends UIButton {
72+
private _draggingID;
73+
private _moveHoldID;
74+
constructor(group: GroupLike, shape: string, states?: {
75+
[key: string]: any;
76+
}, id?: string);
77+
onDrag(fn: UIHandler): number;
78+
offDrag(id: number): boolean;
79+
onDrop(fn: UIHandler): number;
80+
offDrop(id: number): boolean;
4681
}

0 commit comments

Comments
 (0)