@dnd-kit/collision 0.0.9-beta-20250208041250 → 0.0.9-beta-20250209014617

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -99,31 +99,13 @@ var closestCorners = (input) => {
99
99
  if (!droppable.shape) {
100
100
  return null;
101
101
  }
102
- const { left, top, right, bottom } = droppable.shape.boundingRectangle;
103
- const corners = [
104
- {
105
- x: left,
106
- y: top
107
- },
108
- {
109
- x: right,
110
- y: top
111
- },
112
- {
113
- x: left,
114
- y: bottom
115
- },
116
- {
117
- x: right,
118
- y: bottom
119
- }
120
- ];
121
- const distance = corners.reduce(
122
- (acc, corner) => {
102
+ const shapeCorners = shape ? corners(shape.current) : void 0;
103
+ const distance = corners(droppable.shape).reduce(
104
+ (acc, corner, index) => {
123
105
  var _a;
124
106
  return acc + import_geometry3.Point.distance(
125
107
  import_geometry3.Point.from(corner),
126
- (_a = shape == null ? void 0 : shape.current.center) != null ? _a : position.current
108
+ (_a = shapeCorners == null ? void 0 : shapeCorners[index]) != null ? _a : position.current
127
109
  );
128
110
  },
129
111
  0
@@ -136,6 +118,15 @@ var closestCorners = (input) => {
136
118
  priority: import_abstract3.CollisionPriority.Normal
137
119
  };
138
120
  };
121
+ function corners(shape) {
122
+ const { left, top, right, bottom } = shape.boundingRectangle;
123
+ return [
124
+ { x: left, y: top },
125
+ { x: right, y: top },
126
+ { x: left, y: bottom },
127
+ { x: right, y: bottom }
128
+ ];
129
+ }
139
130
 
140
131
  // src/algorithms/closestCenter.ts
141
132
  var import_abstract4 = require("@dnd-kit/abstract");
package/dist/index.js CHANGED
@@ -67,31 +67,13 @@ var closestCorners = (input) => {
67
67
  if (!droppable.shape) {
68
68
  return null;
69
69
  }
70
- const { left, top, right, bottom } = droppable.shape.boundingRectangle;
71
- const corners = [
72
- {
73
- x: left,
74
- y: top
75
- },
76
- {
77
- x: right,
78
- y: top
79
- },
80
- {
81
- x: left,
82
- y: bottom
83
- },
84
- {
85
- x: right,
86
- y: bottom
87
- }
88
- ];
89
- const distance = corners.reduce(
90
- (acc, corner) => {
70
+ const shapeCorners = shape ? corners(shape.current) : void 0;
71
+ const distance = corners(droppable.shape).reduce(
72
+ (acc, corner, index) => {
91
73
  var _a;
92
74
  return acc + Point3.distance(
93
75
  Point3.from(corner),
94
- (_a = shape == null ? void 0 : shape.current.center) != null ? _a : position.current
76
+ (_a = shapeCorners == null ? void 0 : shapeCorners[index]) != null ? _a : position.current
95
77
  );
96
78
  },
97
79
  0
@@ -104,6 +86,15 @@ var closestCorners = (input) => {
104
86
  priority: CollisionPriority3.Normal
105
87
  };
106
88
  };
89
+ function corners(shape) {
90
+ const { left, top, right, bottom } = shape.boundingRectangle;
91
+ return [
92
+ { x: left, y: top },
93
+ { x: right, y: top },
94
+ { x: left, y: bottom },
95
+ { x: right, y: bottom }
96
+ ];
97
+ }
107
98
 
108
99
  // src/algorithms/closestCenter.ts
109
100
  import { CollisionPriority as CollisionPriority4, CollisionType as CollisionType4 } from "@dnd-kit/abstract";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dnd-kit/collision",
3
3
  "type": "module",
4
- "version": "0.0.9-beta-20250208041250",
4
+ "version": "0.0.9-beta-20250209014617",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -24,8 +24,8 @@
24
24
  "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
25
25
  },
26
26
  "dependencies": {
27
- "@dnd-kit/abstract": "0.0.9-beta-20250208041250",
28
- "@dnd-kit/geometry": "0.0.9-beta-20250208041250",
27
+ "@dnd-kit/abstract": "0.0.9-beta-20250209014617",
28
+ "@dnd-kit/geometry": "0.0.9-beta-20250209014617",
29
29
  "tslib": "^2.6.2"
30
30
  },
31
31
  "devDependencies": {