aboutsummaryrefslogtreecommitdiff
path: root/space.js
diff options
context:
space:
mode:
authorHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 13:50:16 -0500
committerHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 13:50:21 -0500
commit639ec59f1913a903dee3bb9068108b78c193d616 (patch)
treede66716ce7013c4a7fb94f7561350aa20a618912 /space.js
parent283faa1479cb0a640ab7055bced6aafea0416835 (diff)
replaced space.subsection quadruplet with coord pair
Diffstat (limited to 'space.js')
-rw-r--r--space.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/space.js b/space.js
index ae0ee50..50ae16c 100644
--- a/space.js
+++ b/space.js
@@ -111,14 +111,14 @@ function Space(){ // CLASS
} if (match) break;}
return loc;
}
- this.subsection = function(range){ // range is a standard quadruplet
+
+ this.subsection = function(range){ // range is a coordinate pair
+ // Similarly excludes this.loc
newspace = new Space();
- for (let line=0; line<=range[2]-range[0]; line++){
+ for (let line=range[0][0]; line<=range[1][0]; line++){
newspace.data.push([]);
- for (let chr=0; chr<=range[3]-range[1]; chr++){
- newspace.data[line].push(
- this.data[line+range[0]][chr+range[1]] || ''
- );
+ for (let chr=range[0][1]; chr<=range[1][1]; chr++){
+ newspace.data[line-range[0][0]].push(this.data[line][chr] || '');
}
}
return newspace;