@zag-js/rect-utils
Advanced tools
Comparing version 0.77.1 to 0.78.0
@@ -93,2 +93,4 @@ interface Point { | ||
declare function getPointAngle(rect: Rect, point: Point, reference?: Point): number; | ||
declare const clampPoint: (position: Point, size: Size, boundaryRect: RectInit) => { | ||
@@ -255,2 +257,2 @@ x: number; | ||
export { AffineTransform, type AlignOptions, type Bounds, type CenterPoint, type DistanceValue, type ElementRectOptions, type HAlign, type Point, type Rect, type RectCenter, type RectCenters, type RectCorner, type RectCorners, type RectEdge, type RectEdges, type RectInit, type RectInset, type RectPoint, type RectPoints, type RectSide, type ScalingOptions, type Size, type SymmetricRectInset, type VAlign, type WindowRectOptions, addPoints, alignRect, clampPoint, clampSize, closest, closestSideToPoint, closestSideToRect, collisions, constrainRect, contains, containsPoint, containsRect, createPoint, createRect, debugPolygon, distance, distanceBtwEdges, distanceFromPoint, distanceFromRect, expand, fromRange, getElementPolygon, getElementRect, getRectCenters, getRectCorners, getRectEdges, getRectFromPoints, getRotationRect, getViewportRect, getWindowRect, inset, intersection, intersects, isPoint, isPointEqual, isPointInPolygon, isRect, isRectEqual, isSizeEqual, isSymmetric, resizeRect, rotate, shift, shrink, subtractPoints, toRad, union }; | ||
export { AffineTransform, type AlignOptions, type Bounds, type CenterPoint, type DistanceValue, type ElementRectOptions, type HAlign, type Point, type Rect, type RectCenter, type RectCenters, type RectCorner, type RectCorners, type RectEdge, type RectEdges, type RectInit, type RectInset, type RectPoint, type RectPoints, type RectSide, type ScalingOptions, type Size, type SymmetricRectInset, type VAlign, type WindowRectOptions, addPoints, alignRect, clampPoint, clampSize, closest, closestSideToPoint, closestSideToRect, collisions, constrainRect, contains, containsPoint, containsRect, createPoint, createRect, debugPolygon, distance, distanceBtwEdges, distanceFromPoint, distanceFromRect, expand, fromRange, getElementPolygon, getElementRect, getPointAngle, getRectCenters, getRectCorners, getRectEdges, getRectFromPoints, getRotationRect, getViewportRect, getWindowRect, inset, intersection, intersects, isPoint, isPointEqual, isPointInPolygon, isRect, isRectEqual, isSizeEqual, isSymmetric, resizeRect, rotate, shift, shrink, subtractPoints, toRad, union }; |
@@ -191,2 +191,10 @@ 'use strict'; | ||
// src/angle.ts | ||
function getPointAngle(rect, point, reference = rect.center) { | ||
const x = point.x - reference.x; | ||
const y = point.y - reference.y; | ||
const deg = Math.atan2(x, y) * (180 / Math.PI) + 180; | ||
return 360 - deg; | ||
} | ||
// src/clamp.ts | ||
@@ -740,2 +748,3 @@ var clamp = (value, min3, max2) => Math.min(Math.max(value, min3), max2); | ||
exports.getElementRect = getElementRect; | ||
exports.getPointAngle = getPointAngle; | ||
exports.getRectCenters = getRectCenters; | ||
@@ -742,0 +751,0 @@ exports.getRectCorners = getRectCorners; |
{ | ||
"name": "@zag-js/rect-utils", | ||
"version": "0.77.1", | ||
"version": "0.78.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
63627
1686