From 11bc5d9e595f87291c4a1a5d6ad88ab230b059fd Mon Sep 17 00:00:00 2001 From: Kevin Aelterman Date: Tue, 19 Mar 2024 12:29:22 +0100 Subject: [PATCH 1/2] Added overloaded definitions for Matrix#multiply. --- types.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types.d.ts b/types.d.ts index 9a5b8a66..bd4c9e7e 100644 --- a/types.d.ts +++ b/types.d.ts @@ -857,6 +857,7 @@ declare module "two.js/src/matrix" { * @description Multiply all components of the matrix against a single scalar value. * @overloaded */ + multiply(a: number): any; /** * @name Two.Matrix#multiply * @function @@ -866,6 +867,7 @@ declare module "two.js/src/matrix" { * @description Multiply all components of a matrix against a 3 component vector. * @overloaded */ + multiply(a: number, b: number, c?: number): [x: number, y: number, z: number]; /** * @name Two.Matrix#multiply * @function From dc20c58a282fd0c61e77836021839b4c2b7dc7d7 Mon Sep 17 00:00:00 2001 From: Kevin Aelterman Date: Tue, 19 Mar 2024 12:29:45 +0100 Subject: [PATCH 2/2] Added Two.BoundingBox. --- types.d.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/types.d.ts b/types.d.ts index bd4c9e7e..97fd5c51 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1462,7 +1462,7 @@ declare module "two.js/src/group" { * @returns {Object} - Returns object with top, left, right, bottom, width, height attributes. * @description Return an object with top, left, right, bottom, width, and height parameters of the group. */ - getBoundingClientRect(shallow?: boolean): any; + getBoundingClientRect(shallow?: boolean): Two.BoundingBox; /** * @name Two.Group#noFill * @function @@ -2469,7 +2469,7 @@ declare module "two.js/src/path" { * @returns {Object} - Returns object with top, left, right, bottom, width, height attributes. * @description Return an object with top, left, right, bottom, width, and height parameters of the path. */ - getBoundingClientRect(shallow?: boolean): any; + getBoundingClientRect(shallow?: boolean): Two.BoundingBox; /** * @name Two.Path#getPointAt * @function @@ -3178,7 +3178,7 @@ declare module "two.js/src/text" { * @returns {Object} - Returns object with top, left, right, bottom, width, height attributes. * @description Return an object with top, left, right, bottom, width, and height parameters of the text object. */ - getBoundingClientRect(shallow?: boolean): any; + getBoundingClientRect(shallow?: boolean): Two.BoundingBox; } import { Shape } from "two.js/src/shape"; import { Gradient } from "two.js/src/effects/gradient"; @@ -3553,7 +3553,7 @@ declare module "two.js/src/shapes/points" { * @returns {Object} - Returns object with top, left, right, bottom, width, height attributes. * @description Return an object with top, left, right, bottom, width, and height parameters of the path. */ - getBoundingClientRect: (shallow?: boolean) => any; + getBoundingClientRect: (shallow?: boolean) => Two.BoundingBox; /** * @name Two.Points#subdivide * @function @@ -4476,6 +4476,15 @@ declare module "two.js" { import { Renderer as CanvasRenderer } from "two.js/src/renderers/canvas"; import { Renderer as SVGRenderer } from "two.js/src/renderers/svg"; import { Renderer as WebGLRenderer } from "two.js/src/renderers/webgl"; + + export type BoundingBox = { + top: number, + left: number, + right: number, + bottom: number, + width: number, + height: number + } } declare module "two.js/extras/jsm/zui" { /**