@jbrowse/plugin-dotplot-view 2.11.1 → 2.12.0

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.
@@ -1,95 +0,0 @@
1
- import { sum } from '@jbrowse/core/util';
2
- export class BlockSet {
3
- constructor(blocks = []) {
4
- this.blocks = blocks;
5
- }
6
- push(block) {
7
- if (block instanceof ElidedBlock && this.blocks.length > 0) {
8
- const lastBlock = this.blocks.at(-1);
9
- if (lastBlock instanceof ElidedBlock) {
10
- lastBlock.push(block);
11
- return;
12
- }
13
- }
14
- this.blocks.push(block);
15
- }
16
- getBlocks() {
17
- return this.blocks;
18
- }
19
- map(func, thisarg) {
20
- // eslint-disable-next-line unicorn/no-array-method-this-argument
21
- return this.blocks.map(func, thisarg);
22
- }
23
- forEach(func, thisarg) {
24
- // eslint-disable-next-line unicorn/no-array-method-this-argument
25
- return this.blocks.forEach(func, thisarg);
26
- }
27
- get length() {
28
- return this.blocks.length;
29
- }
30
- get totalWidthPx() {
31
- return this.blocks.length
32
- ? sum(this.blocks.map(blocks => blocks.widthPx))
33
- : 0;
34
- }
35
- get offsetPx() {
36
- return this.blocks.length ? this.blocks[0].offsetPx : 0;
37
- }
38
- get contentBlocks() {
39
- return this.blocks.filter(block => block instanceof ContentBlock);
40
- }
41
- }
42
- export class BaseBlock {
43
- /**
44
- * a block that should be shown as filled with data
45
- */
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
- constructor(data) {
48
- this.widthPx = 0;
49
- this.offsetPx = 0;
50
- Object.assign(this, data);
51
- this.assemblyName = data.assemblyName;
52
- this.refName = data.refName;
53
- this.start = data.start;
54
- this.end = data.end;
55
- this.key = data.key;
56
- }
57
- toRegion() {
58
- return {
59
- refName: this.refName,
60
- start: this.start,
61
- end: this.end,
62
- assemblyName: this.assemblyName,
63
- reversed: this.reversed,
64
- };
65
- }
66
- }
67
- export class ContentBlock extends BaseBlock {
68
- }
69
- /**
70
- * marker block representing one or more blocks that are
71
- * too small to be shown at the current zoom level
72
- */
73
- export class ElidedBlock extends BaseBlock {
74
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
- constructor(data) {
76
- super(data);
77
- this.elidedBlockCount = 0;
78
- this.widthPx = data.widthPx;
79
- }
80
- push(otherBlock) {
81
- this.elidedBlockCount += 1;
82
- if (otherBlock) {
83
- this.refName = '';
84
- this.start = 0;
85
- this.end = 0;
86
- this.widthPx += otherBlock.widthPx;
87
- }
88
- }
89
- }
90
- /**
91
- * marker block that sits between two different displayed regions
92
- * and provides a thick border between them
93
- */
94
- export class InterRegionPaddingBlock extends BaseBlock {
95
- }