Skip to content

Commit

Permalink
Update typings and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
williamngan committed Aug 24, 2018
1 parent 69537ed commit 491218a
Show file tree
Hide file tree
Showing 64 changed files with 3,970 additions and 1,689 deletions.
1 change: 1 addition & 0 deletions dist/files/Op.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export declare class Rectangle {
}
export declare class Circle {
static fromRect(pts: GroupLike, enclose?: boolean): Group;
static fromTriangle(pts: GroupLike, enclose?: boolean): Group;
static fromCenter(pt: PtLike, radius: number): Group;
static withinBound(pts: GroupLike, pt: PtLike, threshold?: number): boolean;
static intersectRay2D(pts: GroupLike, ray: GroupLike): Group;
Expand Down
8 changes: 8 additions & 0 deletions dist/files/Op.js

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

2 changes: 1 addition & 1 deletion dist/files/Space.js

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

2 changes: 1 addition & 1 deletion dist/files/Types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ export declare type IntersectContext = {
edge: Group;
other?: any;
};
export declare type UIHandler = (pt: Pt, target: UI, type: string) => void;
export declare type UIHandler = (target: UI, pt: PtLike, type: string) => void;
export declare type WarningType = "error" | "warn" | "mute";
81 changes: 58 additions & 23 deletions dist/files/UI.d.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,81 @@
import { Pt, Group } from "./Pt";
import { UIHandler } from "./Types";
export declare enum UIShape {
Rectangle = 0,
Circle = 1,
Polygon = 2,
Polyline = 3,
Line = 4
}
import { Group } from "./Pt";
import { UIHandler, GroupLike, PtLike } from "./Types";
export declare const UIShape: {
rectangle: string;
circle: string;
polygon: string;
polyline: string;
line: string;
};
export declare const UIPointerActions: {
up: string;
down: string;
move: string;
drag: string;
uidrag: string;
drop: string;
over: string;
out: string;
enter: string;
leave: string;
all: string;
};
export declare class UI {
group: Group;
shape: UIShape;
_group: Group;
_shape: string;
protected static _counter: number;
protected _id: string;
protected _actions: {
[key: string]: UIHandler;
[key: string]: UIHandler[];
};
protected _states: {
[key: string]: any;
};
constructor(group: Group, shape: UIShape, states: {}, id?: string);
protected _holds: string[];
constructor(group: GroupLike, shape: string, states?: {
[key: string]: any;
}, id?: string);
static fromRectangle(group: GroupLike, states: {}, id?: string): UI;
static fromCircle(group: GroupLike, states: {}, id?: string): UI;
static fromPolygon(group: GroupLike, states: {}, id?: string): UI;
static fromUI(ui: UI, states?: object, id?: string): UI;
id: string;
state(key: string): any;
on(key: string, fn: UIHandler): this;
off(key: string): this;
listen(key: string, p: Pt): boolean;
group: Group;
shape: string;
state(key: string, value?: any): any;
on(key: string, fn: UIHandler): number;
off(key: string, which?: number): boolean;
listen(key: string, p: PtLike): boolean;
protected hold(key: string): number;
protected unhold(id?: number): void;
static track(uis: UI[], key: string, p: PtLike): void;
render(fn: (group: Group, states: {
[key: string]: any;
}) => void): void;
protected _trigger(p: Pt): boolean;
toString(): string;
protected _within(p: PtLike): boolean;
protected static _trigger(fns: UIHandler[], target: UI, pt: PtLike, type: string): void;
protected static _addHandler(fns: UIHandler[], fn: UIHandler): number;
protected static _removeHandler(fns: UIHandler[], index: number): boolean;
}
export declare class UIButton extends UI {
_clicks: number;
constructor(group: Group, shape: UIShape, states: {}, id?: string);
readonly clicks: number;
onClick(fn: UIHandler): void;
onHover(over: UIHandler, out: UIHandler): void;
private _hoverID;
constructor(group: GroupLike, shape: string, states?: {
[key: string]: any;
}, id?: string);
onClick(fn: UIHandler): number;
offClick(id: number): boolean;
onHover(enter?: UIHandler, leave?: UIHandler): number[];
offHover(enterID?: number, leaveID?: number): boolean[];
}
export declare class UIDragger extends UIButton {
private _draggingID;
private _moveHoldID;
constructor(group: GroupLike, shape: string, states?: {
[key: string]: any;
}, id?: string);
onDrag(fn: UIHandler): number;
offDrag(id: number): boolean;
onDrop(fn: UIHandler): number;
offDrop(id: number): boolean;
}
Loading

0 comments on commit 491218a

Please sign in to comment.