Fixed typings and documentation

This commit is contained in:
ilyabeskrovniy
2020-07-07 10:27:22 +03:00
parent 6ac6948609
commit 115b647bf6
2 changed files with 22 additions and 9 deletions

View File

@@ -64,7 +64,7 @@ There are several settings that could be defined or modified per node:
* **collapsed**: if it is shown collapsed (small)
* **redraw_on_mouse**: forces a redraw if the mouse passes over the widget
* **widgets_up**: widgets do not start after the slots
* **widgets_y**: widgets should start being drawn from this Y
* **widgets_start_y**: widgets should start being drawn from this Y
* **clip_area**: clips the content when rendering the node
* **resizable**: if it can be resized dragging the corner
* **horizontal**: if the slots should be placed horizontally on the top and bottom of the node

29
src/litegraph.d.ts vendored
View File

@@ -15,7 +15,7 @@ export type widgetTypes =
/** https://github.com/jagenjo/litegraph.js/tree/master/guides#node-slots */
export interface INodeSlot {
name: string;
type: string;
type: string | -1;
label?: string;
dir?:
| typeof LiteGraph.UP
@@ -601,7 +601,9 @@ export declare class LGraphNode {
properties: Record<string, any>;
properties_info: any[];
flags: object;
flags: Partial<{
collapsed: boolean
}>;
color: string;
bgcolor: string;
@@ -623,6 +625,17 @@ export declare class LGraphNode {
| typeof LiteGraph.NEVER
| typeof LiteGraph.ALWAYS;
/** If set to true widgets do not start after the slots */
widgets_up: boolean;
/** widgets start at y distance from the top of the node */
widgets_start_y: number;
/** if you render outside the node, it will be clipped */
clip_area: boolean;
/** if set to false it wont be resizable with the mouse */
resizable: boolean;
/** slots are distributed horizontally */
horizontal: boolean;
/** configure a node from an object containing the serialized info */
configure(info: SerializedLGraphNode): void;
/** serialize the content */
@@ -715,7 +728,7 @@ export declare class LGraphNode {
*/
addOutput(
name: string,
type: string,
type: string | -1,
extra_info?: Partial<INodeOutputSlot>
): void;
/**
@@ -723,7 +736,7 @@ export declare class LGraphNode {
* @param array of triplets like [[name,type,extra_info],[...]]
*/
addOutputs(
array: [string, string, Partial<INodeOutputSlot> | undefined][]
array: [string, string | -1, Partial<INodeOutputSlot> | undefined][]
): void;
/** remove an existing output slot */
removeOutput(slot: number): void;
@@ -735,7 +748,7 @@ export declare class LGraphNode {
*/
addInput(
name: string,
type: string,
type: string | -1,
extra_info?: Partial<INodeInputSlot>
): void;
/**
@@ -743,7 +756,7 @@ export declare class LGraphNode {
* @param array of triplets like [[name,type,extra_info],[...]]
*/
addInputs(
array: [string, string, Partial<INodeInputSlot> | undefined][]
array: [string, string | -1, Partial<INodeInputSlot> | undefined][]
): void;
/** remove an existing input slot */
removeInput(slot: number): void;
@@ -777,7 +790,7 @@ export declare class LGraphNode {
type: T["type"],
name: string,
value: T["value"],
callback?: WidgetCallback<T>,
callback?: WidgetCallback<T> | string,
options?: T["options"]
): T;
@@ -1111,7 +1124,7 @@ export declare class LGraphCanvas {
last_mouse_position: Vector2;
/** Timestamp of last mouse click, defaults to 0 */
last_mouseclick: number;
link_render_mode:
links_render_mode:
| typeof LiteGraph.STRAIGHT_LINK
| typeof LiteGraph.LINEAR_LINK
| typeof LiteGraph.SPLINE_LINK;