aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 02:17:11 -0500
committerHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 14:57:57 -0500
commit940dcce9582a537b6c1a08dd08e04221b6fcf696 (patch)
tree09a31ead6119f2ef58ab790ff756eef0aa86a10e
parent73cd58b75cd881adf87de1ba31cf29e71897c885 (diff)
repaired space.comb
-rw-r--r--space.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/space.js b/space.js
index 4159fc9..d94a212 100644
--- a/space.js
+++ b/space.js
@@ -101,12 +101,13 @@ function Space(){
}
if (offset[1] < 0) offset[1] = 0;
- // Iterate over other.data and add to this.data
+ // Parse over all relevant tiles and process them into usable chars (this.data is all relevant tiles due to padding)
while (this.data.length < offset[0]+other.data.length) this.data.push([]); // Row padding
for (let row = 0; row < this.data.length; row++){
- while (this.data[row].length < offset[1]+other.data[row+offset[0]].length) thisrow.push(''); // Character-wise padding
+ let otherrow = other.data[row-offset[0]] || [];
+ while (this.data[row].length < offset[1]+otherrow.length) this.data[row].push(''); // Character-wise padding
for (let chr = 0; chr < this.data[row].length; chr++){
- thisrow[chr] = func(thisrow[chr], other.data[row+offset[0]][chr+offset[1]] || '');
+ this.data[row][chr] = func(this.data[row][chr], otherrow[chr-offset[1]] || '');
}
}
}