|
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 | +}; |
10 | 10 | export declare const UIPointerActions: {
|
11 | 11 | up: string;
|
12 | 12 | down: string;
|
13 | 13 | move: string;
|
14 | 14 | drag: string;
|
| 15 | + uidrag: string; |
15 | 16 | drop: string;
|
16 | 17 | over: string;
|
17 | 18 | out: string;
|
| 19 | + enter: string; |
| 20 | + leave: string; |
| 21 | + all: string; |
18 | 22 | };
|
19 | 23 | export declare class UI {
|
20 |
| - group: Group; |
21 |
| - shape: UIShape; |
| 24 | + _group: Group; |
| 25 | + _shape: string; |
| 26 | + protected static _counter: number; |
22 | 27 | protected _id: string;
|
23 | 28 | protected _actions: {
|
24 |
| - [key: string]: UIHandler; |
| 29 | + [key: string]: UIHandler[]; |
25 | 30 | };
|
26 | 31 | protected _states: {
|
27 | 32 | [key: string]: any;
|
28 | 33 | };
|
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; |
30 | 42 | 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; |
35 | 52 | render(fn: (group: Group, states: {
|
36 | 53 | [key: string]: any;
|
37 | 54 | }) => 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; |
39 | 60 | }
|
40 | 61 | 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; |
46 | 81 | }
|
0 commit comments