From 6646041ba464c166e747c2d7e8fa7d9c949207d1 Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Mon, 22 Apr 2019 08:49:20 -0400 Subject: [PATCH] Fix Rectangle.Clamp() --- src/Rectangle.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Rectangle.js b/src/Rectangle.js index 7659e22..4e0af72 100644 --- a/src/Rectangle.js +++ b/src/Rectangle.js @@ -98,11 +98,11 @@ class Rectangle { this.right = Math.min(this.right, right); this.bottom = Math.max(this.bottom, bottom); this.top = Math.min(this.top, top); - // Ensure rectangle coordinates in order. - this.left = Math.min(this.left, this.right); - this.right = Math.max(this.right, this.left); - this.bottom = Math.min(this.bottom, this.top); - this.top = Math.max(this.top, this.bottom); + + this.left = Math.min(this.left, right); + this.right = Math.max(this.right, left); + this.bottom = Math.min(this.bottom, top); + this.top = Math.max(this.top, bottom); } /**