react-msaview 1.3.1 → 2.0.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.
- package/bundle/index.js +283 -97265
- package/dist/StructureModel.d.ts +9 -0
- package/dist/StructureModel.js +11 -0
- package/dist/StructureModel.js.map +1 -0
- package/dist/UniprotTrack.d.ts +27 -0
- package/dist/UniprotTrack.js +52 -0
- package/dist/UniprotTrack.js.map +1 -0
- package/dist/colorSchemes.d.ts +2 -2
- package/dist/colorSchemes.js +24 -29
- package/dist/colorSchemes.js.map +1 -0
- package/dist/components/AboutDlg.d.ts +0 -1
- package/dist/components/AboutDlg.js +38 -48
- package/dist/components/AboutDlg.js.map +1 -0
- package/dist/components/AddTrackDlg.d.ts +0 -1
- package/dist/components/AddTrackDlg.js +13 -13
- package/dist/components/AddTrackDlg.js.map +1 -0
- package/dist/components/AnnotationDlg.d.ts +0 -1
- package/dist/components/AnnotationDlg.js +36 -48
- package/dist/components/AnnotationDlg.js.map +1 -0
- package/dist/components/BoxTrack.d.ts +3 -4
- package/dist/components/BoxTrack.js +51 -48
- package/dist/components/BoxTrack.js.map +1 -0
- package/dist/components/DetailsDlg.d.ts +0 -1
- package/dist/components/DetailsDlg.js +7 -7
- package/dist/components/DetailsDlg.js.map +1 -0
- package/dist/components/Header.d.ts +0 -1
- package/dist/components/Header.js +39 -34
- package/dist/components/Header.js.map +1 -0
- package/dist/components/ImportForm.d.ts +0 -1
- package/dist/components/ImportForm.js +59 -71
- package/dist/components/ImportForm.js.map +1 -0
- package/dist/components/MSACanvas.d.ts +0 -1
- package/dist/components/MSACanvas.js +71 -74
- package/dist/components/MSACanvas.js.map +1 -0
- package/dist/components/MSAView.d.ts +0 -1
- package/dist/components/MSAView.js +19 -38
- package/dist/components/MSAView.js.map +1 -0
- package/dist/components/MoreInfoDlg.d.ts +2 -3
- package/dist/components/MoreInfoDlg.js +5 -5
- package/dist/components/MoreInfoDlg.js.map +1 -0
- package/dist/components/ResizeHandles.d.ts +2 -3
- package/dist/components/ResizeHandles.js +31 -32
- package/dist/components/ResizeHandles.js.map +1 -0
- package/dist/components/Rubberband.d.ts +2 -1
- package/dist/components/Rubberband.js +42 -64
- package/dist/components/Rubberband.js.map +1 -0
- package/dist/components/Ruler.d.ts +0 -15
- package/dist/components/Ruler.js +18 -87
- package/dist/components/Ruler.js.map +1 -0
- package/dist/components/SettingsDlg.d.ts +0 -1
- package/dist/components/SettingsDlg.js +29 -22
- package/dist/components/SettingsDlg.js.map +1 -0
- package/dist/components/TextTrack.d.ts +3 -4
- package/dist/components/TextTrack.js +23 -24
- package/dist/components/TextTrack.js.map +1 -0
- package/dist/components/Track.d.ts +2 -3
- package/dist/components/Track.js +38 -38
- package/dist/components/Track.js.map +1 -0
- package/dist/components/TrackInfoDlg.d.ts +5 -3
- package/dist/components/TrackInfoDlg.js +12 -13
- package/dist/components/TrackInfoDlg.js.map +1 -0
- package/dist/components/TracklistDlg.d.ts +0 -1
- package/dist/components/TracklistDlg.js +9 -9
- package/dist/components/TracklistDlg.js.map +1 -0
- package/dist/components/TreeCanvas.d.ts +0 -1
- package/dist/components/TreeCanvas.js +135 -148
- package/dist/components/TreeCanvas.js.map +1 -0
- package/dist/components/TreeRuler.d.ts +0 -1
- package/dist/components/TreeRuler.js +3 -3
- package/dist/components/TreeRuler.js.map +1 -0
- package/dist/components/VerticalGuide.d.ts +6 -0
- package/dist/components/VerticalGuide.js +30 -0
- package/dist/components/VerticalGuide.js.map +1 -0
- package/dist/components/data/seq2.d.ts +3 -3
- package/dist/components/data/seq2.js +33 -3
- package/dist/components/data/seq2.js.map +1 -0
- package/{bundle/components/Ruler.d.ts → dist/components/util.d.ts} +1 -6
- package/dist/components/util.js +69 -0
- package/dist/components/util.js.map +1 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -0
- package/dist/layout.js +14 -20
- package/dist/layout.js.map +1 -0
- package/dist/model.d.ts +94 -74
- package/dist/model.js +232 -473
- package/dist/model.js.map +1 -0
- package/dist/parseNewick.d.ts +1 -5
- package/dist/parseNewick.js +10 -7
- package/dist/parseNewick.js.map +1 -0
- package/dist/parsers/ClustalMSA.d.ts +6 -18
- package/dist/parsers/ClustalMSA.js +55 -64
- package/dist/parsers/ClustalMSA.js.map +1 -0
- package/dist/parsers/FastaMSA.d.ts +4 -9
- package/dist/parsers/FastaMSA.js +55 -64
- package/dist/parsers/FastaMSA.js.map +1 -0
- package/dist/parsers/StockholmMSA.d.ts +8 -13
- package/dist/parsers/StockholmMSA.js +78 -107
- package/dist/parsers/StockholmMSA.js.map +1 -0
- package/dist/util.d.ts +33 -4
- package/dist/util.js +76 -24
- package/dist/util.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +30 -30
- package/src/StructureModel.ts +11 -0
- package/src/UniprotTrack.ts +60 -0
- package/src/colorSchemes.ts +520 -0
- package/src/components/AboutDlg.tsx +64 -0
- package/src/components/AddTrackDlg.tsx +74 -0
- package/src/components/AnnotationDlg.tsx +144 -0
- package/src/components/BoxTrack.tsx +225 -0
- package/src/components/DetailsDlg.tsx +28 -0
- package/src/components/Header.tsx +117 -0
- package/src/components/ImportForm.tsx +192 -0
- package/src/components/MSACanvas.tsx +297 -0
- package/src/components/MSAView.tsx +132 -0
- package/src/components/MoreInfoDlg.tsx +21 -0
- package/src/components/ResizeHandles.tsx +137 -0
- package/src/components/Rubberband.tsx +271 -0
- package/src/components/Ruler.tsx +122 -0
- package/src/components/SettingsDlg.tsx +154 -0
- package/src/components/TextTrack.tsx +120 -0
- package/src/components/Track.tsx +150 -0
- package/src/components/TrackInfoDlg.tsx +59 -0
- package/src/components/TracklistDlg.tsx +61 -0
- package/src/components/TreeCanvas.tsx +633 -0
- package/src/components/TreeRuler.tsx +12 -0
- package/src/components/VerticalGuide.tsx +50 -0
- package/src/components/data/seq2.ts +35 -0
- package/src/components/util.ts +94 -0
- package/src/declare.d.ts +2 -0
- package/src/index.ts +2 -0
- package/src/layout.ts +83 -0
- package/src/model.ts +790 -0
- package/{bundle/parseNewick.d.ts → src/parseNewick.ts} +36 -5
- package/src/parsers/ClustalMSA.ts +79 -0
- package/src/parsers/FastaMSA.ts +82 -0
- package/src/parsers/StockholmMSA.ts +137 -0
- package/src/util.ts +142 -0
- package/src/version.ts +1 -0
- package/bundle/colorSchemes.d.ts +0 -16
- package/bundle/colorSchemes.js +0 -455
- package/bundle/components/AboutDlg.d.ts +0 -5
- package/bundle/components/AboutDlg.js +0 -47
- package/bundle/components/AddTrackDlg.d.ts +0 -8
- package/bundle/components/AddTrackDlg.js +0 -26
- package/bundle/components/AnnotationDlg.d.ts +0 -11
- package/bundle/components/AnnotationDlg.js +0 -77
- package/bundle/components/BoxTrack.d.ts +0 -7
- package/bundle/components/BoxTrack.js +0 -143
- package/bundle/components/DetailsDlg.d.ts +0 -8
- package/bundle/components/DetailsDlg.js +0 -12
- package/bundle/components/Header.d.ts +0 -6
- package/bundle/components/Header.js +0 -63
- package/bundle/components/ImportForm.d.ts +0 -6
- package/bundle/components/ImportForm.js +0 -89
- package/bundle/components/MSACanvas.d.ts +0 -6
- package/bundle/components/MSACanvas.js +0 -210
- package/bundle/components/MSAView.d.ts +0 -6
- package/bundle/components/MSAView.js +0 -88
- package/bundle/components/MoreInfoDlg.d.ts +0 -6
- package/bundle/components/MoreInfoDlg.js +0 -11
- package/bundle/components/ResizeHandles.d.ts +0 -8
- package/bundle/components/ResizeHandles.js +0 -110
- package/bundle/components/Rubberband.d.ts +0 -7
- package/bundle/components/Rubberband.js +0 -196
- package/bundle/components/Ruler.js +0 -121
- package/bundle/components/SettingsDlg.d.ts +0 -8
- package/bundle/components/SettingsDlg.js +0 -40
- package/bundle/components/TextTrack.d.ts +0 -7
- package/bundle/components/TextTrack.js +0 -72
- package/bundle/components/Track.d.ts +0 -11
- package/bundle/components/Track.js +0 -81
- package/bundle/components/TrackInfoDlg.d.ts +0 -6
- package/bundle/components/TrackInfoDlg.js +0 -33
- package/bundle/components/TracklistDlg.d.ts +0 -8
- package/bundle/components/TracklistDlg.js +0 -18
- package/bundle/components/TreeCanvas.d.ts +0 -6
- package/bundle/components/TreeCanvas.js +0 -431
- package/bundle/components/TreeRuler.d.ts +0 -6
- package/bundle/components/TreeRuler.js +0 -8
- package/bundle/components/data/seq2.d.ts +0 -3
- package/bundle/components/data/seq2.js +0 -3
- package/bundle/index.d.ts +0 -4
- package/bundle/layout.d.ts +0 -23
- package/bundle/layout.js +0 -53
- package/bundle/model.d.ts +0 -364
- package/bundle/model.js +0 -894
- package/bundle/parseNewick.js +0 -94
- package/bundle/parsers/ClustalMSA.d.ts +0 -39
- package/bundle/parsers/ClustalMSA.js +0 -77
- package/bundle/parsers/FastaMSA.d.ts +0 -26
- package/bundle/parsers/FastaMSA.js +0 -78
- package/bundle/parsers/StockholmMSA.d.ts +0 -75
- package/bundle/parsers/StockholmMSA.js +0 -142
- package/bundle/util.d.ts +0 -17
- package/bundle/util.js +0 -33
- package/dist/components/package.json +0 -62
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const smallMSA = `CLUSTAL O(1.2.3) multiple sequence alignment
|
|
2
|
+
UniProt/Swiss-Prot|P26898|IL2RA_SHEEP MEPSLLMWRFFVFIVVPGCVTEACHDDPPSLRNA----------MFKVLRYE----VGTM
|
|
3
|
+
UniProt/Swiss-Prot|P01590|IL2RA_MOUSE MEPRLLMLGFLSLTIVPSCRAELCLYDPPEVPNA----------TFKALSYK----NGTI
|
|
4
|
+
UniProt/Swiss-Prot|P41690|IL2RA_FELCA MEPSLLLWGILTFVVVHGHVTELCDENPPDIQHA----------TFKALTYK----TGTM
|
|
5
|
+
UniProt/Swiss-Prot|P01589|IL2RA_HUMAN MDSYLLMWGLLTFIMVPGCQAELCDDDPPEIPHA----------TFKAMAYK----EGTM
|
|
6
|
+
UniProt/Swiss-Prot|Q5MNY4|IL2RA_MACMU MDPYLLMWGLLTFITVPGCQAELCDDDPPKITHA----------TFKAVAYK----EGTM
|
|
7
|
+
UniProt/Swiss-Prot|Q95118|IL2RG_BOVIN -----------------------------------LLMWGLLT-----------------
|
|
8
|
+
UniProt/Swiss-Prot|P40321|IL2RG_CANFA MLKPPLPLRSLLFLQLSLLGVGLNSTVPMPNGNEDIT------PDFFLTATPSETLSVSS
|
|
9
|
+
UniProt/Swiss-Prot|P26896|IL2RB_RAT MATVDLSWRLPLYILLLLLATT--------------------------------WVSAAV
|
|
10
|
+
UniProt/Swiss-Prot|Q8BZM1|GLMN_MOUSE PLPLRSLLFLQLPLLGVGLNP------------------PLPLRSLLFLQLPLLGVGLNP
|
|
11
|
+
UniProt/Swiss-Prot|P36835|IL2_CAPHI -----------LLGVGLNPKFLTP------------------------------------
|
|
12
|
+
UniProt/Swiss-Prot|Q7JFM4|IL2_AOTVO MLKPPLPLRSLLFLQLPLLGVGLNPKFLTPSGNEDIGGKPGTGGDFFLTSTPAGTLDVST
|
|
13
|
+
UniProt/Swiss-Prot|Q29416|IL2_CANFA --------------LFLQLSLLG-------------------------------------
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
export const smallMSAOnly = `CLUSTAL O(1.2.4) multiple sequence alignment
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
sp|P69905|HBA_HUMAN MVLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTTKTYFPHFDLSHGSAQVKGHG 60
|
|
20
|
+
sp|P01942|HBA_MOUSE MVLSGEDKSNIKAAWGKIGGHGAEYGAEALERMFASFPTTKTYFPHFDVSHGSAQVKGHG 60
|
|
21
|
+
sp|P13786|HBAZ_CAPHI MSLTRTERTIILSLWSKISTQADVIGTETLERLFSCYPQAKTYFPHFDLHSGSAQLRAHG 60
|
|
22
|
+
* *: ::: : : *.*:. :. *:*:***:* .:* :********: ****::.**
|
|
23
|
+
|
|
24
|
+
sp|P69905|HBA_HUMAN KKVADALTNAVAHVDDMPNALSALSDLHAHKLRVDPVNFKLLSHCLLVTLAAHLPAEFTP 120
|
|
25
|
+
sp|P01942|HBA_MOUSE KKVADALASAAGHLDDLPGALSALSDLHAHKLRVDPVNFKLLSHCLLVTLASHHPADFTP 120
|
|
26
|
+
sp|P13786|HBAZ_CAPHI SKVVAAVGDAVKSIDNVTSALSKLSELHAYVLRVDPVNFKFLSHCLLVTLASHFPADFTA 120
|
|
27
|
+
.**. *: .*. :*:: .*** **:***: *********:**********:* **:**
|
|
28
|
+
|
|
29
|
+
sp|P69905|HBA_HUMAN AVHASLDKFLASVSTVLTSKYR 142
|
|
30
|
+
sp|P01942|HBA_MOUSE AVHASLDKFLASVSTVLTSKYR 142
|
|
31
|
+
sp|P13786|HBAZ_CAPHI DAHAAWDKFLSIVSGVLTEKYR 142
|
|
32
|
+
.**: ****: ** ***.***`
|
|
33
|
+
|
|
34
|
+
export const smallTree =
|
|
35
|
+
'(((UniProt/Swiss-Prot|P26898|IL2RA_SHEEP:0.24036,(UniProt/Swiss-Prot|P41690|IL2RA_FELCA:0.17737,(UniProt/Swiss-Prot|P01589|IL2RA_HUMAN:0.03906,UniProt/Swiss-Prot|Q5MNY4|IL2RA_MACMU:0.03787):0.13033):0.04964):0.02189,UniProt/Swiss-Prot|P01590|IL2RA_MOUSE:0.23072):0.06814,(((UniProt/Swiss-Prot|Q95118|IL2RG_BOVIN:0.09600,UniProt/Swiss-Prot|P40321|IL2RG_CANFA:0.09845):0.25333,UniProt/Swiss-Prot|Q29416|IL2_CANFA:-0.35055):0.10231,(UniProt/Swiss-Prot|P26896|IL2RB_RAT:0.33631,UniProt/Swiss-Prot|Q7JFM4|IL2_AOTVO:-0.33631):0.10166):0.01607,(UniProt/Swiss-Prot|Q8BZM1|GLMN_MOUSE:0.32378,UniProt/Swiss-Prot|P36835|IL2_CAPHI:-0.32378):0.09999)'
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given a scale ( bp/px ) and minimum distances (px) between major and minor
|
|
3
|
+
* gridlines, return an object like `{ majorPitch: bp, minorPitch: bp }` giving
|
|
4
|
+
* the gridline pitches to use.
|
|
5
|
+
*/
|
|
6
|
+
export function chooseGridPitch(
|
|
7
|
+
scale: number,
|
|
8
|
+
minMajorPitchPx: number,
|
|
9
|
+
minMinorPitchPx: number,
|
|
10
|
+
) {
|
|
11
|
+
scale = Math.abs(scale)
|
|
12
|
+
const minMajorPitchBp = minMajorPitchPx * scale
|
|
13
|
+
const majorMagnitude = parseInt(
|
|
14
|
+
Number(minMajorPitchBp).toExponential().split(/e/i)[1],
|
|
15
|
+
10,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
let majorPitch = 10 ** majorMagnitude
|
|
19
|
+
while (majorPitch < minMajorPitchBp) {
|
|
20
|
+
majorPitch *= 2
|
|
21
|
+
if (majorPitch >= minMajorPitchBp) {
|
|
22
|
+
break
|
|
23
|
+
}
|
|
24
|
+
majorPitch *= 2.5
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
majorPitch = Math.max(majorPitch, 5)
|
|
28
|
+
|
|
29
|
+
const majorPitchPx = majorPitch / scale
|
|
30
|
+
|
|
31
|
+
let minorPitch = 0
|
|
32
|
+
if (!(majorPitch % 10) && majorPitchPx / 10 >= minMinorPitchPx) {
|
|
33
|
+
minorPitch = majorPitch / 10
|
|
34
|
+
} else if (!(majorPitch % 5) && majorPitchPx / 5 >= minMinorPitchPx) {
|
|
35
|
+
minorPitch = majorPitch / 5
|
|
36
|
+
} else if (!(majorPitch % 2) && majorPitchPx / 2 >= minMinorPitchPx) {
|
|
37
|
+
minorPitch = majorPitch / 2
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return { majorPitch, minorPitch }
|
|
41
|
+
}
|
|
42
|
+
export function makeTicks(
|
|
43
|
+
start: number,
|
|
44
|
+
end: number,
|
|
45
|
+
bpPerPx: number,
|
|
46
|
+
emitMajor = true,
|
|
47
|
+
emitMinor = true,
|
|
48
|
+
) {
|
|
49
|
+
const gridPitch = chooseGridPitch(bpPerPx, 60, 15)
|
|
50
|
+
|
|
51
|
+
let minBase = start
|
|
52
|
+
let maxBase = end
|
|
53
|
+
if (minBase === null || maxBase === null) {
|
|
54
|
+
return []
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (bpPerPx < 0) {
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-extra-semi
|
|
59
|
+
;[minBase, maxBase] = [maxBase, minBase]
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// add 20px additional on the right and left to allow us to draw the ends of
|
|
63
|
+
// labels that lie a little outside our region
|
|
64
|
+
minBase -= Math.abs(20 * bpPerPx)
|
|
65
|
+
maxBase += Math.abs(20 * bpPerPx) + 1
|
|
66
|
+
|
|
67
|
+
const iterPitch = gridPitch.minorPitch || gridPitch.majorPitch
|
|
68
|
+
let index = 0
|
|
69
|
+
const ticks = []
|
|
70
|
+
for (
|
|
71
|
+
let base = Math.ceil(minBase / iterPitch) * iterPitch;
|
|
72
|
+
base < maxBase;
|
|
73
|
+
base += iterPitch
|
|
74
|
+
) {
|
|
75
|
+
if (emitMinor && base % (gridPitch.majorPitch * 2)) {
|
|
76
|
+
ticks.push({ type: 'minor', base: base - 1, index })
|
|
77
|
+
index += 1
|
|
78
|
+
} else if (emitMajor && !(base % (gridPitch.majorPitch * 2))) {
|
|
79
|
+
ticks.push({ type: 'major', base: base - 1, index })
|
|
80
|
+
index += 1
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return ticks
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function mathPower(num: number): string {
|
|
87
|
+
if (num < 999) {
|
|
88
|
+
return String(num)
|
|
89
|
+
}
|
|
90
|
+
return `${mathPower(~~(num / 1000))},${`00${~~(num % 1000)}`.slice(
|
|
91
|
+
-3,
|
|
92
|
+
-3 + 3,
|
|
93
|
+
)}`
|
|
94
|
+
}
|
package/src/declare.d.ts
ADDED
package/src/index.ts
ADDED
package/src/layout.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import RBush from 'rbush'
|
|
2
|
+
|
|
3
|
+
export default class Layout {
|
|
4
|
+
public rectangles: Map<
|
|
5
|
+
string,
|
|
6
|
+
{
|
|
7
|
+
minY: number
|
|
8
|
+
maxY: number
|
|
9
|
+
minX: number
|
|
10
|
+
maxX: number
|
|
11
|
+
id: string
|
|
12
|
+
data: unknown
|
|
13
|
+
}
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
public maxHeightReached: boolean
|
|
17
|
+
|
|
18
|
+
private maxHeight: number
|
|
19
|
+
|
|
20
|
+
private rbush: RBush<{ id: string }>
|
|
21
|
+
|
|
22
|
+
private pTotalHeight: number
|
|
23
|
+
|
|
24
|
+
constructor({
|
|
25
|
+
maxHeight = 10000,
|
|
26
|
+
}: {
|
|
27
|
+
maxHeight?: number
|
|
28
|
+
} = {}) {
|
|
29
|
+
this.maxHeightReached = false
|
|
30
|
+
this.rbush = new RBush()
|
|
31
|
+
this.rectangles = new Map()
|
|
32
|
+
this.maxHeight = Math.ceil(maxHeight)
|
|
33
|
+
this.pTotalHeight = 0 // total height, in units of bitmap squares (px/pitchY)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @returns top position for the rect, or Null if laying
|
|
38
|
+
* out the rect would exceed maxHeighe
|
|
39
|
+
*/
|
|
40
|
+
addRect(
|
|
41
|
+
id: string,
|
|
42
|
+
left: number,
|
|
43
|
+
right: number,
|
|
44
|
+
height: number,
|
|
45
|
+
data: unknown,
|
|
46
|
+
): number | null {
|
|
47
|
+
// add to rbush
|
|
48
|
+
const existingRecord = this.rectangles.get(id)
|
|
49
|
+
if (existingRecord) {
|
|
50
|
+
return existingRecord.minY
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let currHeight = 0
|
|
54
|
+
while (
|
|
55
|
+
this.rbush.collides({
|
|
56
|
+
minX: left,
|
|
57
|
+
minY: currHeight,
|
|
58
|
+
maxX: right,
|
|
59
|
+
maxY: currHeight + height,
|
|
60
|
+
}) &&
|
|
61
|
+
currHeight <= this.maxHeight
|
|
62
|
+
) {
|
|
63
|
+
currHeight += 1
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const record = {
|
|
67
|
+
minX: left,
|
|
68
|
+
minY: currHeight,
|
|
69
|
+
maxX: right,
|
|
70
|
+
maxY: currHeight + height,
|
|
71
|
+
id,
|
|
72
|
+
data,
|
|
73
|
+
}
|
|
74
|
+
this.rbush.insert(record)
|
|
75
|
+
this.rectangles.set(id, record)
|
|
76
|
+
this.pTotalHeight = Math.max(this.pTotalHeight, currHeight)
|
|
77
|
+
return currHeight
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get totalHeight() {
|
|
81
|
+
return this.pTotalHeight
|
|
82
|
+
}
|
|
83
|
+
}
|