@openneuro/app 4.6.1 → 4.6.2
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/.scss-lint.yml +0 -1
- package/Dockerfile +1 -1
- package/package.json +7 -6
- package/src/index.html +0 -1
- package/src/scripts/dataset/dataset-query.jsx +10 -7
- package/src/scripts/dataset/draft-container.tsx +7 -0
- package/src/scripts/dataset/files/file-display.jsx +21 -32
- package/src/scripts/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +52 -84
- package/src/scripts/dataset/files/viewers/file-viewer-json.jsx +8 -14
- package/src/scripts/dataset/files/viewers/file-viewer-nifti.jsx +19 -13
- package/src/scripts/dataset/snapshot-container.tsx +239 -226
- package/src/scripts/errors/404page.tsx +3 -0
- package/src/assets/papaya.js +0 -2101
- package/src/scripts/common/partials/papaya.jsx +0 -97
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
/* global papaya, papayaContainers, globalThis */
|
|
4
|
-
import React from 'react'
|
|
5
|
-
import PropTypes from 'prop-types'
|
|
6
|
-
|
|
7
|
-
class Papaya extends React.Component {
|
|
8
|
-
// life cycle events --------------------------------------------------
|
|
9
|
-
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props)
|
|
12
|
-
this.state = {
|
|
13
|
-
papayaWidth: this._calculateWidth(),
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
componentDidMount() {
|
|
18
|
-
// clear any old containers
|
|
19
|
-
// eslint-disable-next-line no-global-assign, @typescript-eslint/no-unused-vars
|
|
20
|
-
globalThis.papayaContainers = []
|
|
21
|
-
|
|
22
|
-
const params = {
|
|
23
|
-
worldSpace: true,
|
|
24
|
-
fullScreen: false,
|
|
25
|
-
allowScroll: false,
|
|
26
|
-
fullScreenPadding: false,
|
|
27
|
-
showControlBar: true,
|
|
28
|
-
showOrientation: true,
|
|
29
|
-
images: [this.props.image],
|
|
30
|
-
kioskMode: true,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// rebuild container
|
|
34
|
-
globalThis.papaya.Container.startPapaya()
|
|
35
|
-
|
|
36
|
-
// start viewer
|
|
37
|
-
globalThis.papaya.Container.resetViewer(0, params)
|
|
38
|
-
|
|
39
|
-
// listen to window resizes
|
|
40
|
-
globalThis.addEventListener('resize', this._updateDimensions.bind(this))
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
componentWillUnmount() {
|
|
44
|
-
globalThis.removeEventListener('resize', this._updateDimensions.bind(this))
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
render() {
|
|
48
|
-
return (
|
|
49
|
-
<div
|
|
50
|
-
className="papaya-wrap"
|
|
51
|
-
style={{ width: this.state.papayaWidth + 'px' }}>
|
|
52
|
-
<div className="papaya" />
|
|
53
|
-
</div>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// custom methods -----------------------------------------------------
|
|
58
|
-
|
|
59
|
-
_calculateWidth() {
|
|
60
|
-
const windowHeight = window.innerHeight
|
|
61
|
-
const headerHeight = 90
|
|
62
|
-
const contentHeight = windowHeight - headerHeight
|
|
63
|
-
|
|
64
|
-
// estimate papaya viewer size ratio
|
|
65
|
-
let denominator
|
|
66
|
-
if (windowHeight > 1150) {
|
|
67
|
-
denominator = 3
|
|
68
|
-
} else if (windowHeight > 800) {
|
|
69
|
-
denominator = 3.2
|
|
70
|
-
} else if (windowHeight > 640) {
|
|
71
|
-
denominator = 3.4
|
|
72
|
-
} else if (windowHeight > 540) {
|
|
73
|
-
denominator = 3.6
|
|
74
|
-
} else if (windowHeight > 480) {
|
|
75
|
-
denominator = 3.8
|
|
76
|
-
} else if (windowHeight > 400) {
|
|
77
|
-
denominator = 4
|
|
78
|
-
} else if (windowHeight > 0) {
|
|
79
|
-
denominator = 4.2
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const viewerWidth = (contentHeight * 4) / denominator
|
|
83
|
-
return viewerWidth
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
_updateDimensions() {
|
|
87
|
-
this.setState({ papayaWidth: this._calculateWidth() })
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// prop validation ----------------------------------------------------
|
|
92
|
-
|
|
93
|
-
Papaya.propTypes = {
|
|
94
|
-
image: PropTypes.string,
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export default Papaya
|