style: Reformat and comment
This commit is contained in:
parent
9d15f22f5d
commit
abf393191c
3 changed files with 8 additions and 9 deletions
|
|
@ -210,14 +210,12 @@ class DragAdv {
|
|||
const rect = this.placeholder.getBoundingClientRect();
|
||||
const windowWidth = window.innerWidth;
|
||||
const windowHeight = window.innerHeight;
|
||||
|
||||
const distances = {
|
||||
left: rect.left,
|
||||
right: windowWidth - rect.right,
|
||||
top: rect.top,
|
||||
bottom: windowHeight - rect.bottom
|
||||
right: windowWidth - rect.right,
|
||||
bottom: windowHeight - rect.bottom,
|
||||
left: rect.left
|
||||
};
|
||||
|
||||
const closestEdge = Object.keys(distances).reduce((a, b) => distances[a] < distances[b] ? a : b);
|
||||
|
||||
this.setPosition(closestEdge, this.barSize);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue