aboutsummaryrefslogtreecommitdiff
path: root/space.js
diff options
context:
space:
mode:
Diffstat (limited to 'space.js')
-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]] || '');
}
}
}