From cd55ead3e2810e209b726faca12fa749f6875d0f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sat, 16 Dec 2017 18:33:16 +0100 Subject: Fix A LOT of type problems, logic flaws, uninitialized variables etc. Most of them were found by phpstorm, so I put in some time and went through the list, fixing quite a bunch of them. --- .../roomplanner/js/lib/jquery-collision.js | 27 ++++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'modules-available/roomplanner/js') diff --git a/modules-available/roomplanner/js/lib/jquery-collision.js b/modules-available/roomplanner/js/lib/jquery-collision.js index 98e37882..eae7ef85 100644 --- a/modules-available/roomplanner/js/lib/jquery-collision.js +++ b/modules-available/roomplanner/js/lib/jquery-collision.js @@ -175,11 +175,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. { if( ! inclusive ) inclusive = false; var epsilon = ( inclusive ? -1 : +1 ) * CollisionCoords.EPSILON; - if( ( x > ( this.x1 + epsilon ) && x < ( this.x2 - epsilon ) ) && - ( y > ( this.y1 + epsilon ) && y < ( this.y2 - epsilon ) ) ) - return true; - else - return false; + return (x > (this.x1 + epsilon) && x < (this.x2 - epsilon)) && + (y > (this.y1 + epsilon) && y < (this.y2 - epsilon)); }; CollisionCoords.prototype.overlaps = function( other, inclusive ) @@ -189,16 +186,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. hit = other._overlaps( this, inclusive ); if( hit.length > 0 ) { - hit[0].dir = hit[0].dir == "Inside" ? "Outside" : - hit[0].dir == "Outside" ? "Inside" : - hit[0].dir == "N" ? "S" : - hit[0].dir == "S" ? "N" : - hit[0].dir == "W" ? "E" : - hit[0].dir == "E" ? "W" : - hit[0].dir == "NE" ? "SW" : - hit[0].dir == "SW" ? "NE" : - hit[0].dir == "SE" ? "NW" : - hit[0].dir == "NW" ? "SE" : + hit[0].dir = hit[0].dir === "Inside" ? "Outside" : + hit[0].dir === "Outside" ? "Inside" : + hit[0].dir === "N" ? "S" : + hit[0].dir === "S" ? "N" : + hit[0].dir === "W" ? "E" : + hit[0].dir === "E" ? "W" : + hit[0].dir === "NE" ? "SW" : + hit[0].dir === "SW" ? "NE" : + hit[0].dir === "SE" ? "NW" : + hit[0].dir === "NW" ? "SE" : undefined; } return hit || []; -- cgit v1.2.3-55-g7522