@packtrack/layout 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,6 +42,10 @@ export class Span {
42
42
  return this.contains(peer.head) || this.contains(peer.tail);
43
43
  }
44
44
  get length() {
45
+ // TODO verify reverse
46
+ if (this.head.section == this.tail.section) {
47
+ return Math.abs(this.head.offset - this.tail.offset);
48
+ }
45
49
  let length = 0;
46
50
  if (this.head.reversed) {
47
51
  length += this.head.section.length - this.head.offset;
@@ -52,11 +56,12 @@ export class Span {
52
56
  for (let section of this.inside) {
53
57
  length += section.length;
54
58
  }
59
+ // TODO verify
55
60
  if (this.tail.reversed) {
56
- length += this.tail.section.length - this.tail.offset;
61
+ length += this.tail.offset;
57
62
  }
58
63
  else {
59
- length += this.tail.offset;
64
+ length += this.tail.section.length - this.tail.offset;
60
65
  }
61
66
  return length;
62
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@packtrack/layout",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "type": "module",
5
5
  "main": ".built/index.js",
6
6
  "typings": ".built/index.d.ts",
package/source/span.ts CHANGED
@@ -46,6 +46,11 @@ export class Span {
46
46
  }
47
47
 
48
48
  get length() {
49
+ // TODO verify reverse
50
+ if (this.head.section == this.tail.section) {
51
+ return Math.abs(this.head.offset - this.tail.offset);
52
+ }
53
+
49
54
  let length = 0;
50
55
 
51
56
  if (this.head.reversed) {
@@ -58,10 +63,11 @@ export class Span {
58
63
  length += section.length;
59
64
  }
60
65
 
66
+ // TODO verify
61
67
  if (this.tail.reversed) {
62
- length += this.tail.section.length - this.tail.offset;
63
- } else {
64
68
  length += this.tail.offset;
69
+ } else {
70
+ length += this.tail.section.length - this.tail.offset;
65
71
  }
66
72
 
67
73
  return length;