MCPcopy Create free account
hub / github.com/Comfy-Org/litegraph.js / findContainingCorner

Method findContainingCorner

src/infrastructure/Rectangle.ts:252–257  ·  view source on GitHub ↗

* Finds the corner (if any) of this rectangle that contains the point [x, y]. * @param x The x-coordinate to check * @param y The y-coordinate to check * @param cornerSize Each corner is treated as an inset square with this width and height. * @returns The compass directi

(x: number, y: number, cornerSize: number)

Source from the content-addressed store, hash-verified

250 * @returns The compass direction of the corner that contains the point, or `undefined` if the point is not in any corner.
251 */
252 findContainingCorner(x: number, y: number, cornerSize: number): CompassCorners | undefined {
253 if (this.isInTopLeftCorner(x, y, cornerSize)) return "NW"
254 if (this.isInTopRightCorner(x, y, cornerSize)) return "NE"
255 if (this.isInBottomLeftCorner(x, y, cornerSize)) return "SW"
256 if (this.isInBottomRightCorner(x, y, cornerSize)) return "SE"
257 }
258
259 /** @returns `true` if the point [{@link x}, {@link y}] is in the top-left corner of this rectangle, otherwise `false`. */
260 isInTopLeftCorner(x: number, y: number, cornerSize: number): boolean {

Callers 2

findResizeDirectionMethod · 0.80

Calls 4

isInTopLeftCornerMethod · 0.95
isInTopRightCornerMethod · 0.95
isInBottomLeftCornerMethod · 0.95
isInBottomRightCornerMethod · 0.95

Tested by

no test coverage detected