repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 925fd0b50f2c6362bb36d96e3d93043c9c7f0618:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 925fd0b50f2c6362bb36d96e3d93043c9c7f0618
Author: James Baicoianu 
Date:   Sun Apr 8 16:40:17 2018 -0700

    Handle reversed min/max case for rect

diff --git a/scripts/sound.js b/scripts/sound.js
index 4c931074b01ed6c03166fa88f31abdf5c8b1529d..
index ..57b5c9cb9043d7e1d3e1665f600ee543cfaa0813 100644
--- a/scripts/sound.js
+++ b/scripts/sound.js
@@ -136,8 +136,12 @@ elation.require(['janusweb.janusbase'], function() {
         this.audio.setPlaybackRate(this.pitch);
       }
       if (this.rect) {
-        var parts = this.rect.split(' ');
-        this.bounds = new THREE.Box3(new THREE.Vector3(parts[0], -Infinity, parts[1]), new THREE.Vector3(parts[2], Infinity, parts[3]));
+        var parts = this.rect.split(' '),
+            minx = Math.min(parts[0], parts[2]),
+            maxx = Math.max(parts[0], parts[2]),
+            minz = Math.min(parts[1], parts[3]),
+            maxz = Math.max(parts[1], parts[3]);
+        this.bounds = new THREE.Box3(new THREE.Vector3(minx, -Infinity, minz), new THREE.Vector3(maxx, Infinity, maxz));
       } else {
         this.bounds = false;
       }

-----END OF PAGE-----