@complat/react-spectra-editor 0.10.13-alpha.5
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/LICENSE +662 -0
- package/README.md +37 -0
- package/dist/actions/edit_peak.js +25 -0
- package/dist/actions/forecast.js +41 -0
- package/dist/actions/integration.js +33 -0
- package/dist/actions/jcamp.js +41 -0
- package/dist/actions/layout.js +17 -0
- package/dist/actions/manager.js +49 -0
- package/dist/actions/meta.js +17 -0
- package/dist/actions/multiplicity.js +57 -0
- package/dist/actions/scan.js +33 -0
- package/dist/actions/shift.js +25 -0
- package/dist/actions/status.js +33 -0
- package/dist/actions/submit.js +41 -0
- package/dist/actions/threshold.js +33 -0
- package/dist/actions/ui.js +50 -0
- package/dist/app.js +125 -0
- package/dist/components/cmd_bar/01_viewer.js +133 -0
- package/dist/components/cmd_bar/02_zoom.js +119 -0
- package/dist/components/cmd_bar/03_peak.js +176 -0
- package/dist/components/cmd_bar/04_integration.js +273 -0
- package/dist/components/cmd_bar/05_multiplicity.js +228 -0
- package/dist/components/cmd_bar/06_undo_redo.js +137 -0
- package/dist/components/cmd_bar/common.js +104 -0
- package/dist/components/cmd_bar/index.js +113 -0
- package/dist/components/cmd_bar/r01_layout.js +351 -0
- package/dist/components/cmd_bar/r02_scan.js +226 -0
- package/dist/components/cmd_bar/r03_threshold.js +209 -0
- package/dist/components/cmd_bar/r04_submit.js +349 -0
- package/dist/components/cmd_bar/r05_submit_btn.js +147 -0
- package/dist/components/cmd_bar/r06_predict_btn.js +307 -0
- package/dist/components/cmd_bar/tri_btn.js +202 -0
- package/dist/components/common/chem.js +115 -0
- package/dist/components/common/comps.js +29 -0
- package/dist/components/common/draw.js +41 -0
- package/dist/components/d3_line/index.js +236 -0
- package/dist/components/d3_line/line_focus.js +765 -0
- package/dist/components/d3_rect/index.js +200 -0
- package/dist/components/d3_rect/rect_focus.js +301 -0
- package/dist/components/forecast/comps.js +337 -0
- package/dist/components/forecast/ir_comps.js +224 -0
- package/dist/components/forecast/ir_viewer.js +172 -0
- package/dist/components/forecast/nmr_comps.js +253 -0
- package/dist/components/forecast/nmr_viewer.js +170 -0
- package/dist/components/forecast/section_loading.js +95 -0
- package/dist/components/forecast_viewer.js +190 -0
- package/dist/components/panel/compare.js +370 -0
- package/dist/components/panel/index.js +191 -0
- package/dist/components/panel/info.js +335 -0
- package/dist/components/panel/multiplicity.js +405 -0
- package/dist/components/panel/multiplicity_coupling.js +195 -0
- package/dist/components/panel/multiplicity_select.js +114 -0
- package/dist/components/panel/peaks.js +296 -0
- package/dist/constants/action_type.js +140 -0
- package/dist/constants/list_layout.js +23 -0
- package/dist/constants/list_shift.js +480 -0
- package/dist/constants/list_ui.js +33 -0
- package/dist/fn.js +31 -0
- package/dist/helpers/brush.js +109 -0
- package/dist/helpers/calc.js +10 -0
- package/dist/helpers/carbonFeatures.js +47 -0
- package/dist/helpers/cfg.js +89 -0
- package/dist/helpers/chem.js +594 -0
- package/dist/helpers/compass.js +91 -0
- package/dist/helpers/converter.js +74 -0
- package/dist/helpers/extractParams.js +77 -0
- package/dist/helpers/extractPeaksEdit.js +69 -0
- package/dist/helpers/focus.js +15 -0
- package/dist/helpers/format.js +403 -0
- package/dist/helpers/init.js +80 -0
- package/dist/helpers/integration.js +30 -0
- package/dist/helpers/mount.js +112 -0
- package/dist/helpers/multiplicity.js +44 -0
- package/dist/helpers/multiplicity_calc.js +117 -0
- package/dist/helpers/multiplicity_complat.js +126 -0
- package/dist/helpers/multiplicity_manual.js +94 -0
- package/dist/helpers/multiplicity_verify_basic.js +196 -0
- package/dist/helpers/shift.js +48 -0
- package/dist/helpers/zoom.js +32 -0
- package/dist/index.js +705 -0
- package/dist/layer_content.js +125 -0
- package/dist/layer_init.js +231 -0
- package/dist/layer_prism.js +186 -0
- package/dist/reducers/index.js +89 -0
- package/dist/reducers/reducer_edit_peak.js +111 -0
- package/dist/reducers/reducer_forecast.js +113 -0
- package/dist/reducers/reducer_integration.js +136 -0
- package/dist/reducers/reducer_jcamp.js +74 -0
- package/dist/reducers/reducer_layout.js +27 -0
- package/dist/reducers/reducer_manager.js +20 -0
- package/dist/reducers/reducer_meta.js +30 -0
- package/dist/reducers/reducer_multiplicity.js +131 -0
- package/dist/reducers/reducer_scan.js +55 -0
- package/dist/reducers/reducer_shift.js +99 -0
- package/dist/reducers/reducer_simulation.js +30 -0
- package/dist/reducers/reducer_status.js +41 -0
- package/dist/reducers/reducer_submit.js +54 -0
- package/dist/reducers/reducer_threshold.js +34 -0
- package/dist/reducers/reducer_ui.js +46 -0
- package/dist/reducers/undo_redo_config.js +24 -0
- package/dist/sagas/index.js +50 -0
- package/dist/sagas/saga_edit_peak.js +84 -0
- package/dist/sagas/saga_manager.js +116 -0
- package/dist/sagas/saga_meta.js +46 -0
- package/dist/sagas/saga_multiplicity.js +387 -0
- package/dist/sagas/saga_ui.js +392 -0
- package/dist/third_party/jAnalyzer.js +596 -0
- package/dist/third_party/peakInterval.js +107 -0
- package/package.json +77 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
+
|
|
9
|
+
var _react = require('react');
|
|
10
|
+
|
|
11
|
+
var _react2 = _interopRequireDefault(_react);
|
|
12
|
+
|
|
13
|
+
var _reactRedux = require('react-redux');
|
|
14
|
+
|
|
15
|
+
var _redux = require('redux');
|
|
16
|
+
|
|
17
|
+
var _propTypes = require('prop-types');
|
|
18
|
+
|
|
19
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
20
|
+
|
|
21
|
+
var _chem = require('../../helpers/chem');
|
|
22
|
+
|
|
23
|
+
var _manager = require('../../actions/manager');
|
|
24
|
+
|
|
25
|
+
var _ui = require('../../actions/ui');
|
|
26
|
+
|
|
27
|
+
var _rect_focus = require('./rect_focus');
|
|
28
|
+
|
|
29
|
+
var _rect_focus2 = _interopRequireDefault(_rect_focus);
|
|
30
|
+
|
|
31
|
+
var _draw = require('../common/draw');
|
|
32
|
+
|
|
33
|
+
var _list_ui = require('../../constants/list_ui');
|
|
34
|
+
|
|
35
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
|
+
|
|
37
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
38
|
+
|
|
39
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
40
|
+
|
|
41
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
42
|
+
|
|
43
|
+
var W = Math.round(window.innerWidth * 0.90 * 9 / 12); // ROI
|
|
44
|
+
var H = Math.round(window.innerHeight * 0.90 * 0.85); // ROI
|
|
45
|
+
|
|
46
|
+
var ViewerRect = function (_React$Component) {
|
|
47
|
+
_inherits(ViewerRect, _React$Component);
|
|
48
|
+
|
|
49
|
+
function ViewerRect(props) {
|
|
50
|
+
_classCallCheck(this, ViewerRect);
|
|
51
|
+
|
|
52
|
+
var _this = _possibleConstructorReturn(this, (ViewerRect.__proto__ || Object.getPrototypeOf(ViewerRect)).call(this, props));
|
|
53
|
+
|
|
54
|
+
var clickUiTargetAct = props.clickUiTargetAct,
|
|
55
|
+
selectUiSweepAct = props.selectUiSweepAct,
|
|
56
|
+
scrollUiWheelAct = props.scrollUiWheelAct;
|
|
57
|
+
|
|
58
|
+
_this.rootKlass = '.d3Rect';
|
|
59
|
+
_this.focus = new _rect_focus2.default({
|
|
60
|
+
W: W, H: H, clickUiTargetAct: clickUiTargetAct, selectUiSweepAct: selectUiSweepAct, scrollUiWheelAct: scrollUiWheelAct
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
_this.normChange = _this.normChange.bind(_this);
|
|
64
|
+
return _this;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
_createClass(ViewerRect, [{
|
|
68
|
+
key: 'componentDidMount',
|
|
69
|
+
value: function componentDidMount() {
|
|
70
|
+
var _props = this.props,
|
|
71
|
+
seed = _props.seed,
|
|
72
|
+
peak = _props.peak,
|
|
73
|
+
cLabel = _props.cLabel,
|
|
74
|
+
xLabel = _props.xLabel,
|
|
75
|
+
yLabel = _props.yLabel,
|
|
76
|
+
feature = _props.feature,
|
|
77
|
+
tTrEndPts = _props.tTrEndPts,
|
|
78
|
+
tSfPeaks = _props.tSfPeaks,
|
|
79
|
+
isHidden = _props.isHidden,
|
|
80
|
+
sweepExtentSt = _props.sweepExtentSt,
|
|
81
|
+
isUiAddIntgSt = _props.isUiAddIntgSt,
|
|
82
|
+
isUiNoBrushSt = _props.isUiNoBrushSt,
|
|
83
|
+
resetAllAct = _props.resetAllAct;
|
|
84
|
+
|
|
85
|
+
(0, _draw.drawDestroy)(this.rootKlass);
|
|
86
|
+
resetAllAct(feature);
|
|
87
|
+
|
|
88
|
+
var filterSeed = seed;
|
|
89
|
+
var filterPeak = peak;
|
|
90
|
+
|
|
91
|
+
(0, _draw.drawMain)(this.rootKlass, W, H);
|
|
92
|
+
this.focus.create({
|
|
93
|
+
filterSeed: filterSeed,
|
|
94
|
+
filterPeak: filterPeak,
|
|
95
|
+
tTrEndPts: tTrEndPts,
|
|
96
|
+
tSfPeaks: tSfPeaks,
|
|
97
|
+
sweepExtentSt: sweepExtentSt,
|
|
98
|
+
isUiAddIntgSt: isUiAddIntgSt,
|
|
99
|
+
isUiNoBrushSt: isUiNoBrushSt
|
|
100
|
+
});
|
|
101
|
+
(0, _draw.drawLabel)(this.rootKlass, cLabel, xLabel, yLabel);
|
|
102
|
+
(0, _draw.drawDisplay)(this.rootKlass, isHidden);
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: 'componentDidUpdate',
|
|
106
|
+
value: function componentDidUpdate(prevProps) {
|
|
107
|
+
var _props2 = this.props,
|
|
108
|
+
seed = _props2.seed,
|
|
109
|
+
peak = _props2.peak,
|
|
110
|
+
tTrEndPts = _props2.tTrEndPts,
|
|
111
|
+
tSfPeaks = _props2.tSfPeaks,
|
|
112
|
+
isHidden = _props2.isHidden,
|
|
113
|
+
sweepExtentSt = _props2.sweepExtentSt,
|
|
114
|
+
isUiAddIntgSt = _props2.isUiAddIntgSt,
|
|
115
|
+
isUiNoBrushSt = _props2.isUiNoBrushSt;
|
|
116
|
+
|
|
117
|
+
this.normChange(prevProps);
|
|
118
|
+
|
|
119
|
+
var filterSeed = seed;
|
|
120
|
+
var filterPeak = peak;
|
|
121
|
+
|
|
122
|
+
this.focus.update({
|
|
123
|
+
filterSeed: filterSeed,
|
|
124
|
+
filterPeak: filterPeak,
|
|
125
|
+
tTrEndPts: tTrEndPts,
|
|
126
|
+
tSfPeaks: tSfPeaks,
|
|
127
|
+
sweepExtentSt: sweepExtentSt,
|
|
128
|
+
isUiAddIntgSt: isUiAddIntgSt,
|
|
129
|
+
isUiNoBrushSt: isUiNoBrushSt
|
|
130
|
+
});
|
|
131
|
+
(0, _draw.drawDisplay)(this.rootKlass, isHidden);
|
|
132
|
+
}
|
|
133
|
+
}, {
|
|
134
|
+
key: 'componentWillUnmount',
|
|
135
|
+
value: function componentWillUnmount() {
|
|
136
|
+
(0, _draw.drawDestroy)(this.rootKlass);
|
|
137
|
+
}
|
|
138
|
+
}, {
|
|
139
|
+
key: 'normChange',
|
|
140
|
+
value: function normChange(prevProps) {
|
|
141
|
+
var _props3 = this.props,
|
|
142
|
+
feature = _props3.feature,
|
|
143
|
+
resetAllAct = _props3.resetAllAct;
|
|
144
|
+
|
|
145
|
+
var oldFeature = prevProps.feature;
|
|
146
|
+
if (oldFeature !== feature) {
|
|
147
|
+
resetAllAct(feature);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}, {
|
|
151
|
+
key: 'render',
|
|
152
|
+
value: function render() {
|
|
153
|
+
return _react2.default.createElement('div', { className: 'd3Rect' });
|
|
154
|
+
}
|
|
155
|
+
}]);
|
|
156
|
+
|
|
157
|
+
return ViewerRect;
|
|
158
|
+
}(_react2.default.Component);
|
|
159
|
+
|
|
160
|
+
var mapStateToProps = function mapStateToProps(state, props) {
|
|
161
|
+
return {
|
|
162
|
+
seed: (0, _chem.Topic2Seed)(state, props),
|
|
163
|
+
peak: (0, _chem.Feature2Peak)(state, props),
|
|
164
|
+
tTrEndPts: (0, _chem.ToThresEndPts)(state, props),
|
|
165
|
+
tSfPeaks: (0, _chem.ToShiftPeaks)(state, props),
|
|
166
|
+
sweepExtentSt: state.ui.sweepExtent,
|
|
167
|
+
isUiAddIntgSt: state.ui.sweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_ADD,
|
|
168
|
+
isUiNoBrushSt: _list_ui.LIST_NON_BRUSH_TYPES.indexOf(state.ui.sweepType) < 0
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
173
|
+
return (0, _redux.bindActionCreators)({
|
|
174
|
+
resetAllAct: _manager.resetAll,
|
|
175
|
+
clickUiTargetAct: _ui.clickUiTarget,
|
|
176
|
+
selectUiSweepAct: _ui.selectUiSweep,
|
|
177
|
+
scrollUiWheelAct: _ui.scrollUiWheel
|
|
178
|
+
}, dispatch);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
ViewerRect.propTypes = {
|
|
182
|
+
seed: _propTypes2.default.array.isRequired,
|
|
183
|
+
peak: _propTypes2.default.array.isRequired,
|
|
184
|
+
cLabel: _propTypes2.default.string.isRequired,
|
|
185
|
+
xLabel: _propTypes2.default.string.isRequired,
|
|
186
|
+
yLabel: _propTypes2.default.string.isRequired,
|
|
187
|
+
feature: _propTypes2.default.object.isRequired,
|
|
188
|
+
tTrEndPts: _propTypes2.default.array.isRequired,
|
|
189
|
+
tSfPeaks: _propTypes2.default.array.isRequired,
|
|
190
|
+
sweepExtentSt: _propTypes2.default.object.isRequired,
|
|
191
|
+
isUiAddIntgSt: _propTypes2.default.bool.isRequired,
|
|
192
|
+
isUiNoBrushSt: _propTypes2.default.bool.isRequired,
|
|
193
|
+
resetAllAct: _propTypes2.default.func.isRequired,
|
|
194
|
+
clickUiTargetAct: _propTypes2.default.func.isRequired,
|
|
195
|
+
selectUiSweepAct: _propTypes2.default.func.isRequired,
|
|
196
|
+
scrollUiWheelAct: _propTypes2.default.func.isRequired,
|
|
197
|
+
isHidden: _propTypes2.default.bool.isRequired
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(ViewerRect);
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
8
|
+
|
|
9
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
10
|
+
|
|
11
|
+
var _d2 = require('d3');
|
|
12
|
+
|
|
13
|
+
var d3 = _interopRequireWildcard(_d2);
|
|
14
|
+
|
|
15
|
+
var _init = require('../../helpers/init');
|
|
16
|
+
|
|
17
|
+
var _brush = require('../../helpers/brush');
|
|
18
|
+
|
|
19
|
+
var _brush2 = _interopRequireDefault(_brush);
|
|
20
|
+
|
|
21
|
+
var _mount = require('../../helpers/mount');
|
|
22
|
+
|
|
23
|
+
var _compass = require('../../helpers/compass');
|
|
24
|
+
|
|
25
|
+
var _converter = require('../../helpers/converter');
|
|
26
|
+
|
|
27
|
+
var _list_layout = require('../../constants/list_layout');
|
|
28
|
+
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
|
|
31
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
32
|
+
|
|
33
|
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
34
|
+
|
|
35
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
36
|
+
|
|
37
|
+
var RectFocus = function () {
|
|
38
|
+
function RectFocus(props) {
|
|
39
|
+
_classCallCheck(this, RectFocus);
|
|
40
|
+
|
|
41
|
+
var W = props.W,
|
|
42
|
+
H = props.H,
|
|
43
|
+
clickUiTargetAct = props.clickUiTargetAct,
|
|
44
|
+
selectUiSweepAct = props.selectUiSweepAct,
|
|
45
|
+
scrollUiWheelAct = props.scrollUiWheelAct;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
this.rootKlass = '.d3Rect';
|
|
49
|
+
this.margin = {
|
|
50
|
+
t: 5,
|
|
51
|
+
b: 40,
|
|
52
|
+
l: 60,
|
|
53
|
+
r: 5
|
|
54
|
+
};
|
|
55
|
+
this.w = W - this.margin.l - this.margin.r;
|
|
56
|
+
this.h = H - this.margin.t - this.margin.b;
|
|
57
|
+
this.clickUiTargetAct = clickUiTargetAct;
|
|
58
|
+
this.selectUiSweepAct = selectUiSweepAct;
|
|
59
|
+
this.scrollUiWheelAct = scrollUiWheelAct;
|
|
60
|
+
this.brush = d3.brush();
|
|
61
|
+
|
|
62
|
+
this.axis = null;
|
|
63
|
+
this.thresLine = null;
|
|
64
|
+
this.grid = null;
|
|
65
|
+
this.ref = null;
|
|
66
|
+
this.ccPattern = null;
|
|
67
|
+
this.data = [];
|
|
68
|
+
this.dataPks = [];
|
|
69
|
+
this.tTrEndPts = null;
|
|
70
|
+
this.tSfPeaks = null;
|
|
71
|
+
this.root = null;
|
|
72
|
+
this.svg = null;
|
|
73
|
+
this.bars = null;
|
|
74
|
+
this.scales = (0, _init.InitScale)(this, false);
|
|
75
|
+
this.axisCall = (0, _init.InitAxisCall)(5);
|
|
76
|
+
this.pathCall = null;
|
|
77
|
+
this.tip = null;
|
|
78
|
+
this.factor = 0.125;
|
|
79
|
+
this.currentExtent = null;
|
|
80
|
+
this.layout = _list_layout.LIST_LAYOUT.MS;
|
|
81
|
+
|
|
82
|
+
this.setTip = this.setTip.bind(this);
|
|
83
|
+
this.setDataParams = this.setDataParams.bind(this);
|
|
84
|
+
this.create = this.create.bind(this);
|
|
85
|
+
this.update = this.update.bind(this);
|
|
86
|
+
this.setConfig = this.setConfig.bind(this);
|
|
87
|
+
this.drawBar = this.drawBar.bind(this);
|
|
88
|
+
this.drawThres = this.drawThres.bind(this);
|
|
89
|
+
this.drawGrid = this.drawGrid.bind(this);
|
|
90
|
+
this.mergedPeaks = this.mergedPeaks.bind(this);
|
|
91
|
+
this.isFirefox = typeof InstallTrigger !== 'undefined';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_createClass(RectFocus, [{
|
|
95
|
+
key: 'setTip',
|
|
96
|
+
value: function setTip() {
|
|
97
|
+
this.tip = (0, _init.InitTip)();
|
|
98
|
+
this.root.call(this.tip);
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: 'setDataParams',
|
|
102
|
+
value: function setDataParams(data, peaks, tTrEndPts, tSfPeaks) {
|
|
103
|
+
this.data = [].concat(_toConsumableArray(data));
|
|
104
|
+
this.dataPks = [].concat(_toConsumableArray(peaks));
|
|
105
|
+
this.tTrEndPts = tTrEndPts;
|
|
106
|
+
this.tSfPeaks = tSfPeaks;
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
key: 'updatePathCall',
|
|
110
|
+
value: function updatePathCall(xt, yt) {
|
|
111
|
+
this.pathCall = d3.line().x(function (d) {
|
|
112
|
+
return xt(d.x);
|
|
113
|
+
}).y(function (d) {
|
|
114
|
+
return yt(d.y);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: 'setConfig',
|
|
119
|
+
value: function setConfig(sweepExtentSt) {
|
|
120
|
+
// Domain Calculate
|
|
121
|
+
var _ref = sweepExtentSt || { xExtent: false, yExtent: false },
|
|
122
|
+
xExtent = _ref.xExtent,
|
|
123
|
+
yExtent = _ref.yExtent;
|
|
124
|
+
|
|
125
|
+
if (!xExtent || !yExtent) {
|
|
126
|
+
var xes = d3.extent(this.data, function (d) {
|
|
127
|
+
return d.x;
|
|
128
|
+
}).sort(function (a, b) {
|
|
129
|
+
return a - b;
|
|
130
|
+
});
|
|
131
|
+
xExtent = { xL: xes[0] - 10, xU: xes[1] + 10 };
|
|
132
|
+
var btm = 0; // MS baseline is always 0.
|
|
133
|
+
var top = d3.max(this.data, function (d) {
|
|
134
|
+
return d.y;
|
|
135
|
+
});
|
|
136
|
+
var height = top - btm;
|
|
137
|
+
yExtent = {
|
|
138
|
+
yL: btm - this.factor * height,
|
|
139
|
+
yU: top + this.factor * height
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
this.scales.x.domain([xExtent.xL, xExtent.xU]);
|
|
144
|
+
this.scales.y.domain([yExtent.yL, yExtent.yU]);
|
|
145
|
+
|
|
146
|
+
// rescale for zoom
|
|
147
|
+
|
|
148
|
+
var _TfRescale = (0, _compass.TfRescale)(this),
|
|
149
|
+
xt = _TfRescale.xt,
|
|
150
|
+
yt = _TfRescale.yt;
|
|
151
|
+
|
|
152
|
+
// Axis Call
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
this.axisCall.x.scale(xt);
|
|
156
|
+
this.axisCall.y.scale(yt);
|
|
157
|
+
|
|
158
|
+
this.currentExtent = { xExtent: xExtent, yExtent: yExtent };
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: 'posHeight',
|
|
162
|
+
value: function posHeight(gnd, val) {
|
|
163
|
+
var h = gnd - val;
|
|
164
|
+
return h >= 0 ? h : 0;
|
|
165
|
+
}
|
|
166
|
+
}, {
|
|
167
|
+
key: 'barColor',
|
|
168
|
+
value: function barColor(y, yRef) {
|
|
169
|
+
return y >= yRef ? 'steelblue' : '#aaa';
|
|
170
|
+
}
|
|
171
|
+
}, {
|
|
172
|
+
key: 'drawBar',
|
|
173
|
+
value: function drawBar() {
|
|
174
|
+
var _this = this;
|
|
175
|
+
|
|
176
|
+
var _TfRescale2 = (0, _compass.TfRescale)(this),
|
|
177
|
+
xt = _TfRescale2.xt,
|
|
178
|
+
yt = _TfRescale2.yt;
|
|
179
|
+
|
|
180
|
+
this.updatePathCall(xt, yt);
|
|
181
|
+
|
|
182
|
+
var yRef = this.tTrEndPts[0].y;
|
|
183
|
+
|
|
184
|
+
var bars = this.bars.selectAll('rect').data(this.data);
|
|
185
|
+
|
|
186
|
+
bars.exit().attr('class', 'exit').remove();
|
|
187
|
+
|
|
188
|
+
var gnd = yt(0);
|
|
189
|
+
bars.enter().append('rect').attr('class', 'enter-bar').attr('width', 1.5).merge(bars).attr('fill', function (d) {
|
|
190
|
+
return _this.barColor(d.y, yRef);
|
|
191
|
+
}).attr('height', function (d) {
|
|
192
|
+
return _this.posHeight(gnd, yt(d.y));
|
|
193
|
+
}).attr('id', function (d) {
|
|
194
|
+
return 'mpp' + Math.round(1000 * d.x);
|
|
195
|
+
}).attr('transform', function (d) {
|
|
196
|
+
return 'translate(' + xt(d.x) + ', ' + yt(d.y) + ')';
|
|
197
|
+
}).on('mouseover', function (d, i, n) {
|
|
198
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '1.0');
|
|
199
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', 'blue');
|
|
200
|
+
var tipParams = { d: d, layout: _this.layout };
|
|
201
|
+
_this.tip.show(tipParams, n[i]);
|
|
202
|
+
}).on('mouseout', function (d, i, n) {
|
|
203
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '1.0');
|
|
204
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', 'red');
|
|
205
|
+
var tipParams = { d: d, layout: _this.layout };
|
|
206
|
+
_this.tip.hide(tipParams, n[i]);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}, {
|
|
210
|
+
key: 'drawThres',
|
|
211
|
+
value: function drawThres() {
|
|
212
|
+
if (this.tTrEndPts.length > 0) {
|
|
213
|
+
this.thresLine.attr('d', this.pathCall(this.tTrEndPts));
|
|
214
|
+
this.thresLine.attr('visibility', 'visible');
|
|
215
|
+
} else {
|
|
216
|
+
this.thresLine.attr('visibility', 'hidden');
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}, {
|
|
220
|
+
key: 'drawGrid',
|
|
221
|
+
value: function drawGrid() {
|
|
222
|
+
this.grid.x.call(this.axisCall.x.tickSize(-this.h, 0, 0)).selectAll('line').attr('stroke', '#ddd').attr('stroke-opacity', 0.6).attr('fill', 'none');
|
|
223
|
+
this.grid.y.call(this.axisCall.y.tickSize(-this.w, 0, 0)).selectAll('line').attr('stroke', '#ddd').attr('stroke-opacity', 0.6).attr('fill', 'none');
|
|
224
|
+
}
|
|
225
|
+
}, {
|
|
226
|
+
key: 'mergedPeaks',
|
|
227
|
+
value: function mergedPeaks(editPeakSt) {
|
|
228
|
+
if (!editPeakSt) return this.dataPks;
|
|
229
|
+
this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt);
|
|
230
|
+
return this.dataPks;
|
|
231
|
+
}
|
|
232
|
+
}, {
|
|
233
|
+
key: 'create',
|
|
234
|
+
value: function create(_ref2) {
|
|
235
|
+
var filterSeed = _ref2.filterSeed,
|
|
236
|
+
filterPeak = _ref2.filterPeak,
|
|
237
|
+
tTrEndPts = _ref2.tTrEndPts,
|
|
238
|
+
tSfPeaks = _ref2.tSfPeaks,
|
|
239
|
+
sweepExtentSt = _ref2.sweepExtentSt,
|
|
240
|
+
isUiAddIntgSt = _ref2.isUiAddIntgSt,
|
|
241
|
+
isUiNoBrushSt = _ref2.isUiNoBrushSt;
|
|
242
|
+
|
|
243
|
+
this.svg = d3.select('.d3Svg');
|
|
244
|
+
(0, _mount.MountMainFrame)(this, 'focus');
|
|
245
|
+
(0, _mount.MountClip)(this);
|
|
246
|
+
|
|
247
|
+
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
|
|
248
|
+
this.setTip();
|
|
249
|
+
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks);
|
|
250
|
+
(0, _compass.MountCompass)(this);
|
|
251
|
+
|
|
252
|
+
this.axis = (0, _mount.MountAxis)(this);
|
|
253
|
+
|
|
254
|
+
var _MountThresLine = (0, _mount.MountThresLine)(this, 'green');
|
|
255
|
+
|
|
256
|
+
var _MountThresLine2 = _slicedToArray(_MountThresLine, 1);
|
|
257
|
+
|
|
258
|
+
this.thresLine = _MountThresLine2[0];
|
|
259
|
+
|
|
260
|
+
this.grid = (0, _mount.MountGrid)(this);
|
|
261
|
+
this.ref = (0, _mount.MountRef)(this);
|
|
262
|
+
this.bars = (0, _mount.MountBars)(this);
|
|
263
|
+
(0, _mount.MountAxisLabelX)(this);
|
|
264
|
+
(0, _mount.MountAxisLabelY)(this);
|
|
265
|
+
|
|
266
|
+
if (this.data && this.data.length > 0) {
|
|
267
|
+
this.setConfig(sweepExtentSt);
|
|
268
|
+
this.drawBar();
|
|
269
|
+
this.drawThres();
|
|
270
|
+
this.drawGrid();
|
|
271
|
+
}
|
|
272
|
+
(0, _brush2.default)(this, isUiAddIntgSt, isUiNoBrushSt);
|
|
273
|
+
}
|
|
274
|
+
}, {
|
|
275
|
+
key: 'update',
|
|
276
|
+
value: function update(_ref3) {
|
|
277
|
+
var filterSeed = _ref3.filterSeed,
|
|
278
|
+
filterPeak = _ref3.filterPeak,
|
|
279
|
+
tTrEndPts = _ref3.tTrEndPts,
|
|
280
|
+
tSfPeaks = _ref3.tSfPeaks,
|
|
281
|
+
sweepExtentSt = _ref3.sweepExtentSt,
|
|
282
|
+
isUiAddIntgSt = _ref3.isUiAddIntgSt,
|
|
283
|
+
isUiNoBrushSt = _ref3.isUiNoBrushSt;
|
|
284
|
+
|
|
285
|
+
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
|
|
286
|
+
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks);
|
|
287
|
+
|
|
288
|
+
if (this.data && this.data.length > 0) {
|
|
289
|
+
this.setConfig(sweepExtentSt);
|
|
290
|
+
this.drawBar();
|
|
291
|
+
this.drawThres();
|
|
292
|
+
this.drawGrid();
|
|
293
|
+
}
|
|
294
|
+
(0, _brush2.default)(this, isUiAddIntgSt, isUiNoBrushSt);
|
|
295
|
+
}
|
|
296
|
+
}]);
|
|
297
|
+
|
|
298
|
+
return RectFocus;
|
|
299
|
+
}();
|
|
300
|
+
|
|
301
|
+
exports.default = RectFocus;
|