diff core.js @ 1338:6cd9c2bce083

Interfaces properly handle outside reference objects. Better core.js comment box handling. InterfaceDOM return their presented ID rather than assumed index.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Tue, 12 Jan 2016 17:10:39 +0000
parents 9a99872c700f
children 6f41badf6416
line wrap: on
line diff
--- a/core.js	Tue Jan 12 14:58:22 2016 +0000
+++ b/core.js	Tue Jan 12 17:10:39 2016 +0000
@@ -1146,8 +1146,6 @@
 			this.interfaceDOM.enable();
 		}
 		this.onplayGain = decibelToLinear(this.specification.gain)*this.buffer.buffer.playbackGain;
-		
-		this.storeDOM.setAttribute('presentedId',this.id);
 		this.storeDOM.setAttribute('playGain',linearToDecibel(this.onplayGain));
 	};
 	
@@ -1159,6 +1157,7 @@
 		{
 			this.interfaceDOM.enable();
 		}
+		this.storeDOM.setAttribute('presentedId',interfaceObject.getPresentedId());
 	};
     
 	this.loopStart = function() {
@@ -2543,18 +2542,13 @@
 	};
 	
 	this.sortCommentBoxes = function() {
-		var holder = [];
-		while (this.commentBoxes.length > 0) {
-			var node = this.commentBoxes.pop(0);
-			holder[node.id] = node;
-		}
-		this.commentBoxes = holder;
+		this.commentBoxes.sort(function(a,b){return a.id - b.id;});
 	};
 	
 	this.showCommentBoxes = function(inject, sort) {
 		if (sort) {interfaceContext.sortCommentBoxes();}
-		for (var i=0; i<interfaceContext.commentBoxes.length; i++) {
-			inject.appendChild(this.commentBoxes[i].trackComment);
+		for (var box of interfaceContext.commentBoxes) {
+			inject.appendChild(box.trackComment);
 		}
 	};