mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-25 02:57:30 +00:00
Improve formatting
This commit is contained in:
parent
9dde8dfc9c
commit
b27a9ea1b0
1 changed files with 8 additions and 2 deletions
|
|
@ -10,8 +10,14 @@ export const right = (box) => box.x + box.width;
|
|||
export const near = (a, b) => Math.abs(a - b) < SNAP_DISTANCE;
|
||||
|
||||
// http://stackoverflow.com/a/3269471/1263117
|
||||
export const overlapX = (a, b) => left(a) <= right(b) + SNAP_DISTANCE && left(b) <= right(a) + SNAP_DISTANCE;
|
||||
export const overlapY = (a, b) => top(a) <= bottom(b) + SNAP_DISTANCE && top(b) <= bottom(a) + SNAP_DISTANCE;
|
||||
export const overlapX = (a, b) => {
|
||||
return left(a) <= right(b) + SNAP_DISTANCE &&
|
||||
left(b) <= right(a) + SNAP_DISTANCE;
|
||||
};
|
||||
export const overlapY = (a, b) => {
|
||||
return top(a) <= bottom(b) + SNAP_DISTANCE &&
|
||||
top(b) <= bottom(a) + SNAP_DISTANCE;
|
||||
};
|
||||
|
||||
export const snap = (boxA, boxB) => {
|
||||
let x, y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue