export function getPosWithEdge (pos, targetSize, parentSize) {
let tempPos = {
top: pos.top,
left: pos.left,
};
let selfHalfWidth = ~~(targetSize.width / 2);
let selfHalfHeight = ~~(targetSize.height / 2);
}
1.~~它代表雙非按位取反運算符,如果你想使用比Math.floor()更快的方法,那就是它了。
2.對於正數,它向下取整;對於負數,向上取整;非數字取值爲0,它具體的表現形式爲:
~~null; // => 0
~~undefined; // => 0
~~Infinity; // => 0
--NaN; // => 0
~~0; // => 0
~~{}; // => 0
~~[]; // => 0
~~(1/0); // => 0
~~false; // => 0
~~true; // => 1
~~1.9; // => 1
~~-1.9; // => -1