@complat/react-spectra-editor 0.10.13 → 0.10.14-alpha.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/dist/components/d3_line/line_focus.js +4 -12
- package/dist/components/d3_multi/index copy.js +275 -0
- package/dist/components/d3_multi/multi_focus copy.js +490 -0
- package/dist/components/forecast/comps.js +1 -1
- package/dist/components/panel/info.js +7 -5
- package/dist/helpers/chem.js +4 -0
- package/package.json +19 -15
|
@@ -450,14 +450,6 @@ var LineFocus = function () {
|
|
|
450
450
|
var ignoreRef = _format2.default.isHplcUvVisLayout(this.layout);
|
|
451
451
|
var itgs = isDisable ? [] : stack;
|
|
452
452
|
|
|
453
|
-
if (itgs.length === 0 || isDisable) {
|
|
454
|
-
// remove drawn are under curve
|
|
455
|
-
var auc = this.tags.aucPath.selectAll('path').data(stack);
|
|
456
|
-
auc.exit().attr('class', 'exit').remove();
|
|
457
|
-
auc.merge(auc);
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
453
|
var igbp = this.tags.igbPath.selectAll('path').data(itgs);
|
|
462
454
|
igbp.exit().attr('class', 'exit').remove();
|
|
463
455
|
var igcp = this.tags.igcPath.selectAll('path').data(itgs);
|
|
@@ -467,10 +459,10 @@ var LineFocus = function () {
|
|
|
467
459
|
igtp.exit().attr('class', 'exit').remove();
|
|
468
460
|
|
|
469
461
|
if (itgs.length === 0 || isDisable) {
|
|
470
|
-
// remove drawn
|
|
471
|
-
var
|
|
472
|
-
|
|
473
|
-
|
|
462
|
+
// remove drawn area under curve
|
|
463
|
+
var auc = this.tags.aucPath.selectAll('path').data(stack);
|
|
464
|
+
auc.exit().attr('class', 'exit').remove();
|
|
465
|
+
auc.merge(auc);
|
|
474
466
|
return;
|
|
475
467
|
}
|
|
476
468
|
|
|
@@ -0,0 +1,275 @@
|
|
|
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 _list_ui = require('../../constants/list_ui');
|
|
28
|
+
|
|
29
|
+
var _cyclic_voltammetry = require('../../actions/cyclic_voltammetry');
|
|
30
|
+
|
|
31
|
+
var _multi_focus = require('./multi_focus');
|
|
32
|
+
|
|
33
|
+
var _multi_focus2 = _interopRequireDefault(_multi_focus);
|
|
34
|
+
|
|
35
|
+
var _draw = require('../common/draw');
|
|
36
|
+
|
|
37
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
38
|
+
|
|
39
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
40
|
+
|
|
41
|
+
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; }
|
|
42
|
+
|
|
43
|
+
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; }
|
|
44
|
+
|
|
45
|
+
var W = Math.round(window.innerWidth * 0.90 * 9 / 12); // ROI
|
|
46
|
+
var H = Math.round(window.innerHeight * 0.90 * 0.85); // ROI
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
var ViewerMulti = function (_React$Component) {
|
|
50
|
+
_inherits(ViewerMulti, _React$Component);
|
|
51
|
+
|
|
52
|
+
function ViewerMulti(props) {
|
|
53
|
+
_classCallCheck(this, ViewerMulti);
|
|
54
|
+
|
|
55
|
+
var _this = _possibleConstructorReturn(this, (ViewerMulti.__proto__ || Object.getPrototypeOf(ViewerMulti)).call(this, props));
|
|
56
|
+
|
|
57
|
+
var _this$props = _this.props,
|
|
58
|
+
id = _this$props.id,
|
|
59
|
+
clickUiTargetAct = _this$props.clickUiTargetAct,
|
|
60
|
+
selectUiSweepAct = _this$props.selectUiSweepAct,
|
|
61
|
+
scrollUiWheelAct = _this$props.scrollUiWheelAct;
|
|
62
|
+
|
|
63
|
+
_this.rootKlass = '.d3Line' + id;
|
|
64
|
+
|
|
65
|
+
_this.focus = new _multi_focus2.default({
|
|
66
|
+
W: W, H: H, id: id, clickUiTargetAct: clickUiTargetAct, selectUiSweepAct: selectUiSweepAct, scrollUiWheelAct: scrollUiWheelAct
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
_this.normChange = _this.normChange.bind(_this);
|
|
70
|
+
_this.initMaxMinPeaks = _this.initMaxMinPeaks.bind(_this);
|
|
71
|
+
return _this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
_createClass(ViewerMulti, [{
|
|
75
|
+
key: 'componentDidMount',
|
|
76
|
+
value: function componentDidMount() {
|
|
77
|
+
var _props = this.props,
|
|
78
|
+
seed = _props.seed,
|
|
79
|
+
peak = _props.peak,
|
|
80
|
+
cLabel = _props.cLabel,
|
|
81
|
+
xLabel = _props.xLabel,
|
|
82
|
+
yLabel = _props.yLabel,
|
|
83
|
+
feature = _props.feature,
|
|
84
|
+
tTrEndPts = _props.tTrEndPts,
|
|
85
|
+
tSfPeaks = _props.tSfPeaks,
|
|
86
|
+
editPeakSt = _props.editPeakSt,
|
|
87
|
+
layoutSt = _props.layoutSt,
|
|
88
|
+
sweepExtentSt = _props.sweepExtentSt,
|
|
89
|
+
isUiNoBrushSt = _props.isUiNoBrushSt,
|
|
90
|
+
isHidden = _props.isHidden,
|
|
91
|
+
resetAllAct = _props.resetAllAct,
|
|
92
|
+
cyclicvoltaSt = _props.cyclicvoltaSt;
|
|
93
|
+
|
|
94
|
+
(0, _draw.drawDestroy)(this.rootKlass);
|
|
95
|
+
resetAllAct(feature);
|
|
96
|
+
this.initMaxMinPeaks();
|
|
97
|
+
|
|
98
|
+
var filterSeed = seed;
|
|
99
|
+
var filterPeak = peak;
|
|
100
|
+
|
|
101
|
+
(0, _draw.drawMain)(this.rootKlass, W, H);
|
|
102
|
+
this.focus.create({
|
|
103
|
+
filterSeed: filterSeed,
|
|
104
|
+
filterPeak: filterPeak,
|
|
105
|
+
tTrEndPts: tTrEndPts,
|
|
106
|
+
tSfPeaks: tSfPeaks,
|
|
107
|
+
editPeakSt: editPeakSt,
|
|
108
|
+
layoutSt: layoutSt,
|
|
109
|
+
sweepExtentSt: sweepExtentSt,
|
|
110
|
+
isUiNoBrushSt: isUiNoBrushSt,
|
|
111
|
+
cyclicvoltaSt: cyclicvoltaSt
|
|
112
|
+
});
|
|
113
|
+
(0, _draw.drawLabel)(this.rootKlass, cLabel, xLabel, yLabel);
|
|
114
|
+
(0, _draw.drawDisplay)(this.rootKlass, isHidden);
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
key: 'componentDidUpdate',
|
|
118
|
+
value: function componentDidUpdate(prevProps) {
|
|
119
|
+
var _props2 = this.props,
|
|
120
|
+
seed = _props2.seed,
|
|
121
|
+
peak = _props2.peak,
|
|
122
|
+
cLabel = _props2.cLabel,
|
|
123
|
+
xLabel = _props2.xLabel,
|
|
124
|
+
yLabel = _props2.yLabel,
|
|
125
|
+
tTrEndPts = _props2.tTrEndPts,
|
|
126
|
+
tSfPeaks = _props2.tSfPeaks,
|
|
127
|
+
editPeakSt = _props2.editPeakSt,
|
|
128
|
+
layoutSt = _props2.layoutSt,
|
|
129
|
+
sweepExtentSt = _props2.sweepExtentSt,
|
|
130
|
+
isUiNoBrushSt = _props2.isUiNoBrushSt,
|
|
131
|
+
isHidden = _props2.isHidden,
|
|
132
|
+
cyclicvoltaSt = _props2.cyclicvoltaSt;
|
|
133
|
+
|
|
134
|
+
this.normChange(prevProps);
|
|
135
|
+
|
|
136
|
+
this.initMaxMinPeaks();
|
|
137
|
+
|
|
138
|
+
var filterSeed = seed;
|
|
139
|
+
var filterPeak = peak;
|
|
140
|
+
|
|
141
|
+
this.focus.update({
|
|
142
|
+
filterSeed: filterSeed,
|
|
143
|
+
filterPeak: filterPeak,
|
|
144
|
+
tTrEndPts: tTrEndPts,
|
|
145
|
+
tSfPeaks: tSfPeaks,
|
|
146
|
+
editPeakSt: editPeakSt,
|
|
147
|
+
layoutSt: layoutSt,
|
|
148
|
+
sweepExtentSt: sweepExtentSt,
|
|
149
|
+
isUiNoBrushSt: isUiNoBrushSt,
|
|
150
|
+
cyclicvoltaSt: cyclicvoltaSt
|
|
151
|
+
});
|
|
152
|
+
(0, _draw.drawLabel)(this.rootKlass, cLabel, xLabel, yLabel);
|
|
153
|
+
(0, _draw.drawDisplay)(this.rootKlass, isHidden);
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: 'componentWillUnmount',
|
|
157
|
+
value: function componentWillUnmount() {
|
|
158
|
+
(0, _draw.drawDestroy)(this.rootKlass);
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: 'normChange',
|
|
162
|
+
value: function normChange(prevProps) {
|
|
163
|
+
var _props3 = this.props,
|
|
164
|
+
feature = _props3.feature,
|
|
165
|
+
resetAllAct = _props3.resetAllAct;
|
|
166
|
+
|
|
167
|
+
var oldFeature = prevProps.feature;
|
|
168
|
+
if (oldFeature !== feature) {
|
|
169
|
+
resetAllAct(feature);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}, {
|
|
173
|
+
key: 'initMaxMinPeaks',
|
|
174
|
+
value: function initMaxMinPeaks() {
|
|
175
|
+
var _props4 = this.props,
|
|
176
|
+
entities = _props4.entities,
|
|
177
|
+
id = _props4.id,
|
|
178
|
+
cyclicvoltaSt = _props4.cyclicvoltaSt,
|
|
179
|
+
maxminPeakSt = _props4.maxminPeakSt,
|
|
180
|
+
addNewCylicVoltaPairPeakAct = _props4.addNewCylicVoltaPairPeakAct,
|
|
181
|
+
addCylicVoltaMaxPeakAct = _props4.addCylicVoltaMaxPeakAct,
|
|
182
|
+
addCylicVoltaMinPeakAct = _props4.addCylicVoltaMinPeakAct;
|
|
183
|
+
|
|
184
|
+
if (cyclicvoltaSt && maxminPeakSt) {
|
|
185
|
+
var spectraList = cyclicvoltaSt.spectraList;
|
|
186
|
+
|
|
187
|
+
var spectra = spectraList[id];
|
|
188
|
+
if (spectra) {
|
|
189
|
+
var list = spectra.list;
|
|
190
|
+
|
|
191
|
+
if (list.length === 0) {
|
|
192
|
+
maxminPeakSt.max.forEach(function (maxPeak, idx) {
|
|
193
|
+
addNewCylicVoltaPairPeakAct(id);
|
|
194
|
+
var minPeak = maxminPeakSt.min[idx];
|
|
195
|
+
addCylicVoltaMaxPeakAct({ peak: maxPeak, index: idx, jcampIdx: id });
|
|
196
|
+
addCylicVoltaMinPeakAct({ peak: minPeak, index: idx, jcampIdx: id });
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
} else {
|
|
200
|
+
addNewCylicVoltaPairPeakAct(id);
|
|
201
|
+
maxminPeakSt.max.forEach(function (maxPeak, idx) {
|
|
202
|
+
addNewCylicVoltaPairPeakAct(id);
|
|
203
|
+
var minPeak = maxminPeakSt.min[idx];
|
|
204
|
+
addCylicVoltaMaxPeakAct({ peak: maxPeak, index: idx, jcampIdx: id });
|
|
205
|
+
addCylicVoltaMinPeakAct({ peak: minPeak, index: idx, jcampIdx: id });
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}, {
|
|
211
|
+
key: 'render',
|
|
212
|
+
value: function render() {
|
|
213
|
+
var id = this.props.id;
|
|
214
|
+
|
|
215
|
+
return _react2.default.createElement('div', { className: 'd3Line' + id });
|
|
216
|
+
}
|
|
217
|
+
}]);
|
|
218
|
+
|
|
219
|
+
return ViewerMulti;
|
|
220
|
+
}(_react2.default.Component);
|
|
221
|
+
|
|
222
|
+
var mapStateToProps = function mapStateToProps(state, props) {
|
|
223
|
+
return {
|
|
224
|
+
seed: (0, _chem.Topic2Seed)(state, props),
|
|
225
|
+
peak: (0, _chem.Feature2Peak)(state, props),
|
|
226
|
+
tTrEndPts: (0, _chem.ToThresEndPts)(state, props),
|
|
227
|
+
tSfPeaks: (0, _chem.ToShiftPeaks)(state, props),
|
|
228
|
+
editPeakSt: state.editPeak.present,
|
|
229
|
+
layoutSt: state.layout,
|
|
230
|
+
sweepExtentSt: state.ui.sweepExtent,
|
|
231
|
+
isUiNoBrushSt: _list_ui.LIST_NON_BRUSH_TYPES.indexOf(state.ui.sweepType) < 0,
|
|
232
|
+
cyclicvoltaSt: state.cyclicvolta,
|
|
233
|
+
maxminPeakSt: (0, _chem.Feature2MaxMinPeak)(state, props)
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
238
|
+
return (0, _redux.bindActionCreators)({
|
|
239
|
+
resetAllAct: _manager.resetAll,
|
|
240
|
+
clickUiTargetAct: _ui.clickUiTarget,
|
|
241
|
+
selectUiSweepAct: _ui.selectUiSweep,
|
|
242
|
+
scrollUiWheelAct: _ui.scrollUiWheel,
|
|
243
|
+
addNewCylicVoltaPairPeakAct: _cyclic_voltammetry.addNewCylicVoltaPairPeak,
|
|
244
|
+
addCylicVoltaMaxPeakAct: _cyclic_voltammetry.addCylicVoltaMaxPeak,
|
|
245
|
+
addCylicVoltaMinPeakAct: _cyclic_voltammetry.addCylicVoltaMinPeak
|
|
246
|
+
}, dispatch);
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
ViewerMulti.propTypes = {
|
|
250
|
+
id: _propTypes2.default.any.isRequired,
|
|
251
|
+
entities: _propTypes2.default.array.isRequired,
|
|
252
|
+
seed: _propTypes2.default.array.isRequired,
|
|
253
|
+
peak: _propTypes2.default.array.isRequired,
|
|
254
|
+
xLabel: _propTypes2.default.string.isRequired,
|
|
255
|
+
yLabel: _propTypes2.default.string.isRequired,
|
|
256
|
+
feature: _propTypes2.default.object.isRequired,
|
|
257
|
+
tTrEndPts: _propTypes2.default.array.isRequired,
|
|
258
|
+
tSfPeaks: _propTypes2.default.array.isRequired,
|
|
259
|
+
editPeakSt: _propTypes2.default.object.isRequired,
|
|
260
|
+
layoutSt: _propTypes2.default.string.isRequired,
|
|
261
|
+
sweepExtentSt: _propTypes2.default.object.isRequired,
|
|
262
|
+
isUiNoBrushSt: _propTypes2.default.bool.isRequired,
|
|
263
|
+
resetAllAct: _propTypes2.default.func.isRequired,
|
|
264
|
+
clickUiTargetAct: _propTypes2.default.func.isRequired,
|
|
265
|
+
selectUiSweepAct: _propTypes2.default.func.isRequired,
|
|
266
|
+
scrollUiWheelAct: _propTypes2.default.func.isRequired,
|
|
267
|
+
isHidden: _propTypes2.default.bool,
|
|
268
|
+
cyclicvoltaSt: _propTypes2.default.object.isRequired,
|
|
269
|
+
maxminPeakSt: _propTypes2.default.object,
|
|
270
|
+
addNewCylicVoltaPairPeakAct: _propTypes2.default.func.isRequired,
|
|
271
|
+
addCylicVoltaMaxPeakAct: _propTypes2.default.func.isRequired,
|
|
272
|
+
addCylicVoltaMinPeakAct: _propTypes2.default.func.isRequired
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(ViewerMulti);
|
|
@@ -0,0 +1,490 @@
|
|
|
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 _d = require('d3');
|
|
10
|
+
|
|
11
|
+
var d3 = _interopRequireWildcard(_d);
|
|
12
|
+
|
|
13
|
+
var _init = require('../../helpers/init');
|
|
14
|
+
|
|
15
|
+
var _mount = require('../../helpers/mount');
|
|
16
|
+
|
|
17
|
+
var _converter = require('../../helpers/converter');
|
|
18
|
+
|
|
19
|
+
var _brush = require('../../helpers/brush');
|
|
20
|
+
|
|
21
|
+
var _brush2 = _interopRequireDefault(_brush);
|
|
22
|
+
|
|
23
|
+
var _compass = require('../../helpers/compass');
|
|
24
|
+
|
|
25
|
+
var _list_layout = require('../../constants/list_layout');
|
|
26
|
+
|
|
27
|
+
var _format = require('../../helpers/format');
|
|
28
|
+
|
|
29
|
+
var _format2 = _interopRequireDefault(_format);
|
|
30
|
+
|
|
31
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
|
+
|
|
33
|
+
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; } }
|
|
34
|
+
|
|
35
|
+
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); } }
|
|
36
|
+
|
|
37
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
38
|
+
|
|
39
|
+
var MultiFocus = function () {
|
|
40
|
+
function MultiFocus(props) {
|
|
41
|
+
_classCallCheck(this, MultiFocus);
|
|
42
|
+
|
|
43
|
+
var W = props.W,
|
|
44
|
+
H = props.H,
|
|
45
|
+
clickUiTargetAct = props.clickUiTargetAct,
|
|
46
|
+
selectUiSweepAct = props.selectUiSweepAct,
|
|
47
|
+
scrollUiWheelAct = props.scrollUiWheelAct,
|
|
48
|
+
id = props.id;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
this.jcampIdx = id;
|
|
52
|
+
this.rootKlass = '.d3Line' + id;
|
|
53
|
+
this.margin = {
|
|
54
|
+
t: 5,
|
|
55
|
+
b: 40,
|
|
56
|
+
l: 60,
|
|
57
|
+
r: 5
|
|
58
|
+
};
|
|
59
|
+
this.w = W - this.margin.l - this.margin.r;
|
|
60
|
+
this.h = H - this.margin.t - this.margin.b;
|
|
61
|
+
this.clickUiTargetAct = clickUiTargetAct;
|
|
62
|
+
this.selectUiSweepAct = selectUiSweepAct;
|
|
63
|
+
this.scrollUiWheelAct = scrollUiWheelAct;
|
|
64
|
+
this.brush = d3.brush();
|
|
65
|
+
this.brushX = d3.brushX();
|
|
66
|
+
|
|
67
|
+
this.axis = null;
|
|
68
|
+
this.path = null;
|
|
69
|
+
this.grid = null;
|
|
70
|
+
this.tags = null;
|
|
71
|
+
this.data = [];
|
|
72
|
+
this.dataPks = [];
|
|
73
|
+
this.dataPeckers = [];
|
|
74
|
+
this.tTrEndPts = null;
|
|
75
|
+
this.tSfPeaks = null;
|
|
76
|
+
this.root = null;
|
|
77
|
+
this.svg = null;
|
|
78
|
+
this.axisCall = (0, _init.InitAxisCall)(5);
|
|
79
|
+
this.pathCall = null;
|
|
80
|
+
this.tip = null;
|
|
81
|
+
this.factor = 0.125;
|
|
82
|
+
this.currentExtent = null;
|
|
83
|
+
this.shouldUpdate = {};
|
|
84
|
+
// this.freq = false;
|
|
85
|
+
this.layout = _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY;
|
|
86
|
+
|
|
87
|
+
this.getShouldUpdate = this.getShouldUpdate.bind(this);
|
|
88
|
+
this.resetShouldUpdate = this.resetShouldUpdate.bind(this);
|
|
89
|
+
this.setTip = this.setTip.bind(this);
|
|
90
|
+
this.setDataParams = this.setDataParams.bind(this);
|
|
91
|
+
this.create = this.create.bind(this);
|
|
92
|
+
this.update = this.update.bind(this);
|
|
93
|
+
this.setConfig = this.setConfig.bind(this);
|
|
94
|
+
this.drawLine = this.drawLine.bind(this);
|
|
95
|
+
this.drawGrid = this.drawGrid.bind(this);
|
|
96
|
+
this.drawPeaks = this.drawPeaks.bind(this);
|
|
97
|
+
this.onClickTarget = this.onClickTarget.bind(this);
|
|
98
|
+
this.mergedPeaks = this.mergedPeaks.bind(this);
|
|
99
|
+
this.setDataPecker = this.setDataPecker.bind(this);
|
|
100
|
+
this.drawPeckers = this.drawPeckers.bind(this);
|
|
101
|
+
this.onClickPecker = this.onClickPecker.bind(this);
|
|
102
|
+
this.isFirefox = typeof InstallTrigger !== 'undefined';
|
|
103
|
+
this.cyclicvoltaSt = null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
_createClass(MultiFocus, [{
|
|
107
|
+
key: 'getShouldUpdate',
|
|
108
|
+
value: function getShouldUpdate(nextEpSt) {
|
|
109
|
+
var _shouldUpdate = this.shouldUpdate,
|
|
110
|
+
prevXt = _shouldUpdate.prevXt,
|
|
111
|
+
prevYt = _shouldUpdate.prevYt,
|
|
112
|
+
prevEpSt = _shouldUpdate.prevEpSt,
|
|
113
|
+
prevLySt = _shouldUpdate.prevLySt,
|
|
114
|
+
prevTePt = _shouldUpdate.prevTePt,
|
|
115
|
+
prevDtPk = _shouldUpdate.prevDtPk,
|
|
116
|
+
prevSfPk = _shouldUpdate.prevSfPk,
|
|
117
|
+
prevData = _shouldUpdate.prevData;
|
|
118
|
+
|
|
119
|
+
var _TfRescale = (0, _compass.TfRescale)(this),
|
|
120
|
+
xt = _TfRescale.xt,
|
|
121
|
+
yt = _TfRescale.yt;
|
|
122
|
+
|
|
123
|
+
var sameXY = xt(1.1) === prevXt && prevYt === yt(1.1);
|
|
124
|
+
var sameEpSt = prevEpSt === nextEpSt;
|
|
125
|
+
var sameLySt = prevLySt === this.layout;
|
|
126
|
+
var sameTePt = prevTePt === this.tTrEndPts.length;
|
|
127
|
+
var sameDtPk = prevDtPk === this.dataPks.length;
|
|
128
|
+
var sameSfPk = prevSfPk === this.tSfPeaks.length;
|
|
129
|
+
var sameData = prevData === this.data.length;
|
|
130
|
+
var sameRef = prevEpSt.prevOffset === nextEpSt.prevOffset;
|
|
131
|
+
this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
|
|
132
|
+
sameXY: sameXY, sameEpSt: sameEpSt, sameLySt: sameLySt, // eslint-disable-line
|
|
133
|
+
sameTePt: sameTePt, sameDtPk: sameDtPk, sameSfPk: sameSfPk, sameData: sameData, sameRef: sameRef // eslint-disable-line
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: 'resetShouldUpdate',
|
|
138
|
+
value: function resetShouldUpdate(prevEpSt) {
|
|
139
|
+
var _TfRescale2 = (0, _compass.TfRescale)(this),
|
|
140
|
+
xt = _TfRescale2.xt,
|
|
141
|
+
yt = _TfRescale2.yt;
|
|
142
|
+
|
|
143
|
+
var prevXt = xt(1.1);
|
|
144
|
+
var prevYt = yt(1.1);
|
|
145
|
+
var prevTePt = this.tTrEndPts.length;
|
|
146
|
+
var prevDtPk = this.dataPks.length;
|
|
147
|
+
var prevSfPk = this.tSfPeaks.length;
|
|
148
|
+
var prevData = this.data.length;
|
|
149
|
+
var prevLySt = this.layout;
|
|
150
|
+
this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
|
|
151
|
+
prevXt: prevXt, prevYt: prevYt, prevEpSt: prevEpSt, prevLySt: prevLySt, // eslint-disable-line
|
|
152
|
+
prevTePt: prevTePt, prevDtPk: prevDtPk, prevSfPk: prevSfPk, prevData: prevData // eslint-disable-line
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: 'setTip',
|
|
157
|
+
value: function setTip() {
|
|
158
|
+
this.tip = (0, _init.InitTip)();
|
|
159
|
+
this.root.call(this.tip);
|
|
160
|
+
}
|
|
161
|
+
}, {
|
|
162
|
+
key: 'setDataParams',
|
|
163
|
+
value: function setDataParams(data, peaks, tTrEndPts, tSfPeaks, layout, cyclicvoltaSt) {
|
|
164
|
+
this.data = [].concat(_toConsumableArray(data));
|
|
165
|
+
this.dataPks = [].concat(_toConsumableArray(peaks));
|
|
166
|
+
this.tTrEndPts = tTrEndPts;
|
|
167
|
+
this.tSfPeaks = tSfPeaks;
|
|
168
|
+
this.layout = layout;
|
|
169
|
+
this.cyclicvoltaSt = cyclicvoltaSt;
|
|
170
|
+
}
|
|
171
|
+
}, {
|
|
172
|
+
key: 'updatePathCall',
|
|
173
|
+
value: function updatePathCall(xt, yt) {
|
|
174
|
+
this.pathCall = d3.line().x(function (d) {
|
|
175
|
+
return xt(d.x);
|
|
176
|
+
}).y(function (d) {
|
|
177
|
+
return yt(d.y);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}, {
|
|
181
|
+
key: 'setConfig',
|
|
182
|
+
value: function setConfig(sweepExtentSt) {
|
|
183
|
+
// Domain Calculate
|
|
184
|
+
var _ref = sweepExtentSt || { xExtent: false, yExtent: false },
|
|
185
|
+
xExtent = _ref.xExtent,
|
|
186
|
+
yExtent = _ref.yExtent;
|
|
187
|
+
|
|
188
|
+
if (!xExtent || !yExtent) {
|
|
189
|
+
var xes = d3.extent(this.data, function (d) {
|
|
190
|
+
return d.x;
|
|
191
|
+
}).sort(function (a, b) {
|
|
192
|
+
return a - b;
|
|
193
|
+
});
|
|
194
|
+
xExtent = { xL: xes[0], xU: xes[1] };
|
|
195
|
+
var btm = d3.min(this.data, function (d) {
|
|
196
|
+
return d.y;
|
|
197
|
+
});
|
|
198
|
+
var top = d3.max(this.data, function (d) {
|
|
199
|
+
return d.y;
|
|
200
|
+
});
|
|
201
|
+
var height = top - btm;
|
|
202
|
+
yExtent = {
|
|
203
|
+
yL: btm - this.factor * height,
|
|
204
|
+
yU: top + this.factor * height
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
this.scales.x.domain([xExtent.xL, xExtent.xU]);
|
|
209
|
+
this.scales.y.domain([yExtent.yL, yExtent.yU]);
|
|
210
|
+
|
|
211
|
+
// rescale for zoom
|
|
212
|
+
|
|
213
|
+
var _TfRescale3 = (0, _compass.TfRescale)(this),
|
|
214
|
+
xt = _TfRescale3.xt,
|
|
215
|
+
yt = _TfRescale3.yt;
|
|
216
|
+
|
|
217
|
+
// Axis Call
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
this.axisCall.x.scale(xt);
|
|
221
|
+
this.axisCall.y.scale(yt);
|
|
222
|
+
|
|
223
|
+
this.currentExtent = { xExtent: xExtent, yExtent: yExtent };
|
|
224
|
+
}
|
|
225
|
+
}, {
|
|
226
|
+
key: 'drawLine',
|
|
227
|
+
value: function drawLine() {
|
|
228
|
+
var _shouldUpdate2 = this.shouldUpdate,
|
|
229
|
+
sameXY = _shouldUpdate2.sameXY,
|
|
230
|
+
sameRef = _shouldUpdate2.sameRef;
|
|
231
|
+
|
|
232
|
+
if (sameXY && sameRef) return;
|
|
233
|
+
|
|
234
|
+
var _TfRescale4 = (0, _compass.TfRescale)(this),
|
|
235
|
+
xt = _TfRescale4.xt,
|
|
236
|
+
yt = _TfRescale4.yt;
|
|
237
|
+
|
|
238
|
+
this.updatePathCall(xt, yt);
|
|
239
|
+
this.path.attr('d', this.pathCall(this.data));
|
|
240
|
+
}
|
|
241
|
+
}, {
|
|
242
|
+
key: 'drawGrid',
|
|
243
|
+
value: function drawGrid() {
|
|
244
|
+
var sameXY = this.shouldUpdate.sameXY;
|
|
245
|
+
|
|
246
|
+
if (sameXY) return;
|
|
247
|
+
|
|
248
|
+
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');
|
|
249
|
+
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');
|
|
250
|
+
}
|
|
251
|
+
}, {
|
|
252
|
+
key: 'onClickTarget',
|
|
253
|
+
value: function onClickTarget(data) {
|
|
254
|
+
d3.event.stopPropagation();
|
|
255
|
+
d3.event.preventDefault();
|
|
256
|
+
var onPeak = true;
|
|
257
|
+
var spectraList = this.cyclicvoltaSt.spectraList;
|
|
258
|
+
|
|
259
|
+
var spectra = spectraList[this.jcampIdx];
|
|
260
|
+
var voltammetryPeakIdx = spectra.selectedIdx;
|
|
261
|
+
this.clickUiTargetAct(data, onPeak, voltammetryPeakIdx, this.jcampIdx);
|
|
262
|
+
}
|
|
263
|
+
}, {
|
|
264
|
+
key: 'onClickPecker',
|
|
265
|
+
value: function onClickPecker(data) {
|
|
266
|
+
d3.event.stopPropagation();
|
|
267
|
+
d3.event.preventDefault();
|
|
268
|
+
var onPecker = true;
|
|
269
|
+
var spectraList = this.cyclicvoltaSt.spectraList;
|
|
270
|
+
|
|
271
|
+
var spectra = spectraList[this.jcampIdx];
|
|
272
|
+
var voltammetryPeakIdx = spectra.selectedIdx;
|
|
273
|
+
this.clickUiTargetAct(data, false, voltammetryPeakIdx, this.jcampIdx, onPecker);
|
|
274
|
+
}
|
|
275
|
+
}, {
|
|
276
|
+
key: 'mergedPeaks',
|
|
277
|
+
value: function mergedPeaks(editPeakSt) {
|
|
278
|
+
if (!editPeakSt) return this.dataPks;
|
|
279
|
+
var spectraList = this.cyclicvoltaSt.spectraList;
|
|
280
|
+
|
|
281
|
+
var spectra = spectraList[this.jcampIdx];
|
|
282
|
+
if (spectra) {
|
|
283
|
+
this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt, spectra.list);
|
|
284
|
+
} else {
|
|
285
|
+
this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt, []);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return this.dataPks;
|
|
289
|
+
}
|
|
290
|
+
}, {
|
|
291
|
+
key: 'setDataPecker',
|
|
292
|
+
value: function setDataPecker() {
|
|
293
|
+
var spectraList = this.cyclicvoltaSt.spectraList;
|
|
294
|
+
|
|
295
|
+
var spectra = spectraList[this.jcampIdx];
|
|
296
|
+
if (spectra) {
|
|
297
|
+
this.dataPeckers = (0, _converter.PeckersEdit)(spectra.list);
|
|
298
|
+
}
|
|
299
|
+
return this.dataPeckers;
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
key: 'drawPeaks',
|
|
303
|
+
value: function drawPeaks(editPeakSt) {
|
|
304
|
+
var _this = this;
|
|
305
|
+
|
|
306
|
+
var _shouldUpdate3 = this.shouldUpdate,
|
|
307
|
+
sameXY = _shouldUpdate3.sameXY,
|
|
308
|
+
sameEpSt = _shouldUpdate3.sameEpSt,
|
|
309
|
+
sameDtPk = _shouldUpdate3.sameDtPk,
|
|
310
|
+
sameSfPk = _shouldUpdate3.sameSfPk;
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
if (!_format2.default.isCyclicVoltaLayout(this.layout) && sameXY && sameEpSt && sameDtPk && sameSfPk) return;
|
|
314
|
+
|
|
315
|
+
// rescale for zoom
|
|
316
|
+
|
|
317
|
+
var _TfRescale5 = (0, _compass.TfRescale)(this),
|
|
318
|
+
xt = _TfRescale5.xt,
|
|
319
|
+
yt = _TfRescale5.yt;
|
|
320
|
+
|
|
321
|
+
var dPks = this.mergedPeaks(editPeakSt);
|
|
322
|
+
|
|
323
|
+
var mpp = this.tags.pPath.selectAll('path').data(dPks);
|
|
324
|
+
mpp.exit().attr('class', 'exit').remove();
|
|
325
|
+
|
|
326
|
+
var linePath = [{ x: -0.5, y: 10 }, { x: -0.5, y: -20 }, { x: 0.5, y: -20 }, { x: 0.5, y: 10 }];
|
|
327
|
+
var lineSymbol = d3.line().x(function (d) {
|
|
328
|
+
return d.x;
|
|
329
|
+
}).y(function (d) {
|
|
330
|
+
return d.y;
|
|
331
|
+
})(linePath);
|
|
332
|
+
|
|
333
|
+
mpp.enter().append('path').attr('d', lineSymbol).attr('class', 'enter-peak').attr('fill', 'red').attr('stroke', 'pink').attr('stroke-width', 3).attr('stroke-opacity', 0.0).merge(mpp).attr('id', function (d) {
|
|
334
|
+
return 'mpp' + Math.round(1000 * d.x);
|
|
335
|
+
}).attr('transform', function (d) {
|
|
336
|
+
return 'translate(' + xt(d.x) + ', ' + yt(d.y) + ')';
|
|
337
|
+
}).on('mouseover', function (d, i, n) {
|
|
338
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '1.0');
|
|
339
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', 'blue');
|
|
340
|
+
var tipParams = { d: d, layout: _this.layout };
|
|
341
|
+
_this.tip.show(tipParams, n[i]);
|
|
342
|
+
}).on('mouseout', function (d, i, n) {
|
|
343
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '0.0');
|
|
344
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', 'red');
|
|
345
|
+
var tipParams = { d: d, layout: _this.layout };
|
|
346
|
+
_this.tip.hide(tipParams, n[i]);
|
|
347
|
+
}).on('click', function (d) {
|
|
348
|
+
return _this.onClickTarget(d);
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
var ignoreRef = _format2.default.isHplcUvVisLayout(this.layout);
|
|
352
|
+
if (ignoreRef) {
|
|
353
|
+
var bpTxt = this.tags.bpTxt.selectAll('text').data(dPks);
|
|
354
|
+
bpTxt.exit().attr('class', 'exit').remove();
|
|
355
|
+
|
|
356
|
+
bpTxt.enter().append('text').attr('class', 'peak-text').attr('font-family', 'Helvetica').style('font-size', '12px').attr('fill', '#228B22').style('text-anchor', 'middle').merge(bpTxt).attr('id', function (d) {
|
|
357
|
+
return 'mpp' + Math.round(1000 * d.x);
|
|
358
|
+
}).text(function (d) {
|
|
359
|
+
return d.x.toFixed(2);
|
|
360
|
+
}).attr('transform', function (d) {
|
|
361
|
+
return 'translate(' + xt(d.x) + ', ' + (yt(d.y) - 25) + ')';
|
|
362
|
+
}).on('click', function (d) {
|
|
363
|
+
return _this.onClickTarget(d);
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}, {
|
|
368
|
+
key: 'drawPeckers',
|
|
369
|
+
value: function drawPeckers() {
|
|
370
|
+
var _this2 = this;
|
|
371
|
+
|
|
372
|
+
var _shouldUpdate4 = this.shouldUpdate,
|
|
373
|
+
sameXY = _shouldUpdate4.sameXY,
|
|
374
|
+
sameEpSt = _shouldUpdate4.sameEpSt,
|
|
375
|
+
sameDtPk = _shouldUpdate4.sameDtPk,
|
|
376
|
+
sameSfPk = _shouldUpdate4.sameSfPk;
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
if (!_format2.default.isCyclicVoltaLayout(this.layout) && sameXY && sameEpSt && sameDtPk && sameSfPk) return;
|
|
380
|
+
|
|
381
|
+
// rescale for zoom
|
|
382
|
+
|
|
383
|
+
var _TfRescale6 = (0, _compass.TfRescale)(this),
|
|
384
|
+
xt = _TfRescale6.xt,
|
|
385
|
+
yt = _TfRescale6.yt;
|
|
386
|
+
|
|
387
|
+
var dPks = this.setDataPecker();
|
|
388
|
+
|
|
389
|
+
var mpp = this.tags.peckerPath.selectAll('path').data(dPks);
|
|
390
|
+
mpp.exit().attr('class', 'exit').remove();
|
|
391
|
+
|
|
392
|
+
var linePath = [{ x: -0.5, y: 10 }, { x: -0.5, y: -20 }, { x: 0.5, y: -20 }, { x: 0.5, y: 10 }];
|
|
393
|
+
var lineSymbol = d3.line().x(function (d) {
|
|
394
|
+
return d.x;
|
|
395
|
+
}).y(function (d) {
|
|
396
|
+
return d.y;
|
|
397
|
+
})(linePath);
|
|
398
|
+
|
|
399
|
+
mpp.enter().append('path').attr('d', lineSymbol).attr('class', 'enter-peak').attr('fill', '#228B22').attr('stroke', 'pink').attr('stroke-width', 3).attr('stroke-opacity', 0.0).merge(mpp).attr('id', function (d) {
|
|
400
|
+
return 'mpp' + Math.round(1000 * d.x);
|
|
401
|
+
}).attr('transform', function (d) {
|
|
402
|
+
return 'translate(' + xt(d.x) + ', ' + yt(d.y) + ')';
|
|
403
|
+
}).on('mouseover', function (d, i, n) {
|
|
404
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '1.0');
|
|
405
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', 'blue');
|
|
406
|
+
var tipParams = { d: d, layout: _this2.layout };
|
|
407
|
+
_this2.tip.show(tipParams, n[i]);
|
|
408
|
+
}).on('mouseout', function (d, i, n) {
|
|
409
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '0.0');
|
|
410
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', '#228B22');
|
|
411
|
+
var tipParams = { d: d, layout: _this2.layout };
|
|
412
|
+
_this2.tip.hide(tipParams, n[i]);
|
|
413
|
+
}).on('click', function (d) {
|
|
414
|
+
return _this2.onClickPecker(d);
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
}, {
|
|
418
|
+
key: 'create',
|
|
419
|
+
value: function create(_ref2) {
|
|
420
|
+
var filterSeed = _ref2.filterSeed,
|
|
421
|
+
filterPeak = _ref2.filterPeak,
|
|
422
|
+
tTrEndPts = _ref2.tTrEndPts,
|
|
423
|
+
tSfPeaks = _ref2.tSfPeaks,
|
|
424
|
+
editPeakSt = _ref2.editPeakSt,
|
|
425
|
+
layoutSt = _ref2.layoutSt,
|
|
426
|
+
sweepExtentSt = _ref2.sweepExtentSt,
|
|
427
|
+
isUiNoBrushSt = _ref2.isUiNoBrushSt,
|
|
428
|
+
cyclicvoltaSt = _ref2.cyclicvoltaSt;
|
|
429
|
+
|
|
430
|
+
this.svg = d3.select(this.rootKlass).select('.d3Svg');
|
|
431
|
+
(0, _mount.MountMainFrame)(this, 'focus');
|
|
432
|
+
(0, _mount.MountClip)(this);
|
|
433
|
+
|
|
434
|
+
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
|
|
435
|
+
this.scales = (0, _init.InitScale)(this, false);
|
|
436
|
+
this.setTip();
|
|
437
|
+
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt);
|
|
438
|
+
(0, _compass.MountCompass)(this);
|
|
439
|
+
|
|
440
|
+
this.axis = (0, _mount.MountAxis)(this);
|
|
441
|
+
this.path = (0, _mount.MountPath)(this, 'steelblue');
|
|
442
|
+
this.grid = (0, _mount.MountGrid)(this);
|
|
443
|
+
this.tags = (0, _mount.MountTags)(this);
|
|
444
|
+
(0, _mount.MountAxisLabelX)(this);
|
|
445
|
+
(0, _mount.MountAxisLabelY)(this);
|
|
446
|
+
|
|
447
|
+
if (this.data && this.data.length > 0) {
|
|
448
|
+
this.setConfig(sweepExtentSt);
|
|
449
|
+
this.drawLine();
|
|
450
|
+
this.drawGrid();
|
|
451
|
+
this.drawPeaks(editPeakSt);
|
|
452
|
+
this.drawPeckers();
|
|
453
|
+
}
|
|
454
|
+
(0, _brush2.default)(this, false, isUiNoBrushSt);
|
|
455
|
+
this.resetShouldUpdate(editPeakSt);
|
|
456
|
+
}
|
|
457
|
+
}, {
|
|
458
|
+
key: 'update',
|
|
459
|
+
value: function update(_ref3) {
|
|
460
|
+
var filterSeed = _ref3.filterSeed,
|
|
461
|
+
filterPeak = _ref3.filterPeak,
|
|
462
|
+
tTrEndPts = _ref3.tTrEndPts,
|
|
463
|
+
tSfPeaks = _ref3.tSfPeaks,
|
|
464
|
+
editPeakSt = _ref3.editPeakSt,
|
|
465
|
+
layoutSt = _ref3.layoutSt,
|
|
466
|
+
sweepExtentSt = _ref3.sweepExtentSt,
|
|
467
|
+
isUiNoBrushSt = _ref3.isUiNoBrushSt,
|
|
468
|
+
cyclicvoltaSt = _ref3.cyclicvoltaSt;
|
|
469
|
+
|
|
470
|
+
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
|
|
471
|
+
this.scales = (0, _init.InitScale)(this, false);
|
|
472
|
+
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt);
|
|
473
|
+
|
|
474
|
+
if (this.data && this.data.length > 0) {
|
|
475
|
+
this.setConfig(sweepExtentSt);
|
|
476
|
+
this.getShouldUpdate(editPeakSt);
|
|
477
|
+
this.drawLine();
|
|
478
|
+
this.drawGrid();
|
|
479
|
+
this.drawPeaks(editPeakSt);
|
|
480
|
+
this.drawPeckers();
|
|
481
|
+
}
|
|
482
|
+
(0, _brush2.default)(this, false, isUiNoBrushSt);
|
|
483
|
+
this.resetShouldUpdate(editPeakSt);
|
|
484
|
+
}
|
|
485
|
+
}]);
|
|
486
|
+
|
|
487
|
+
return MultiFocus;
|
|
488
|
+
}();
|
|
489
|
+
|
|
490
|
+
exports.default = MultiFocus;
|
|
@@ -13,7 +13,7 @@ var _classnames = require('classnames');
|
|
|
13
13
|
|
|
14
14
|
var _classnames2 = _interopRequireDefault(_classnames);
|
|
15
15
|
|
|
16
|
-
var _reactSvgFileZoomPan = require('react-svg-file-zoom-pan');
|
|
16
|
+
var _reactSvgFileZoomPan = require('@complat/react-svg-file-zoom-pan');
|
|
17
17
|
|
|
18
18
|
var _reactSvgFileZoomPan2 = _interopRequireDefault(_reactSvgFileZoomPan);
|
|
19
19
|
|
|
@@ -20,7 +20,7 @@ var _reactRedux = require('react-redux');
|
|
|
20
20
|
|
|
21
21
|
var _redux = require('redux');
|
|
22
22
|
|
|
23
|
-
var _reactSvgFileZoomPan = require('react-svg-file-zoom-pan');
|
|
23
|
+
var _reactSvgFileZoomPan = require('@complat/react-svg-file-zoom-pan');
|
|
24
24
|
|
|
25
25
|
var _reactSvgFileZoomPan2 = _interopRequireDefault(_reactSvgFileZoomPan);
|
|
26
26
|
|
|
@@ -149,10 +149,12 @@ var aucValue = function aucValue(integration) {
|
|
|
149
149
|
});
|
|
150
150
|
sumVal = sumVal.toFixed(2);
|
|
151
151
|
stackIntegration.forEach(function (inte) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
if (inte.absoluteArea) {
|
|
153
|
+
var areaVal = inte.absoluteArea.toFixed(2);
|
|
154
|
+
var percent = (areaVal * 100 / sumVal).toFixed(2);
|
|
155
|
+
var valStr = areaVal + " (" + percent + "%)";
|
|
156
|
+
values.push(valStr);
|
|
157
|
+
}
|
|
156
158
|
});
|
|
157
159
|
}
|
|
158
160
|
return values.join(", ");
|
package/dist/helpers/chem.js
CHANGED
|
@@ -585,8 +585,12 @@ var Convert2Thres = function Convert2Thres(feature, thresSt) {
|
|
|
585
585
|
|
|
586
586
|
var Convert2DValue = function Convert2DValue(doubleTheta) {
|
|
587
587
|
var lambda = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.15406;
|
|
588
|
+
var isRadian = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
588
589
|
|
|
589
590
|
var theta = doubleTheta / 2;
|
|
591
|
+
if (isRadian) {
|
|
592
|
+
theta = theta / 180 * Math.PI;
|
|
593
|
+
}
|
|
590
594
|
var sinTheta = Math.sin(theta);
|
|
591
595
|
var dValue = lambda / (2 * sinTheta);
|
|
592
596
|
return dValue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@complat/react-spectra-editor",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.14-alpha.2",
|
|
4
4
|
"description": "An editor to View and Edit Chemical Spectra data (NMR, IR and MS).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
},
|
|
9
9
|
"license": "AGPL-3.0",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@
|
|
12
|
-
"@material-ui/
|
|
11
|
+
"@complat/react-svg-file-zoom-pan": "^1.0.11",
|
|
12
|
+
"@material-ui/core": "^4.10.0",
|
|
13
|
+
"@material-ui/icons": "^4.10.0",
|
|
13
14
|
"@mdi/js": "^4.7.95",
|
|
14
15
|
"@mdi/react": "^1.2.1",
|
|
15
16
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
|
17
|
+
"babel-preset-env": "^1.7.0",
|
|
18
|
+
"babel-preset-react": "^6.24.1",
|
|
16
19
|
"browserslist": "^4.16.3",
|
|
17
20
|
"classnames": "^2.2.6",
|
|
18
21
|
"d3": "^5.5.0",
|
|
@@ -22,8 +25,8 @@
|
|
|
22
25
|
"ml-savitzky-golay-generalized": "1.1.1",
|
|
23
26
|
"prop-types": "^15.7.2",
|
|
24
27
|
"react-dropzone": "^8.0.3",
|
|
25
|
-
"react-quill": "1.
|
|
26
|
-
"react-redux": "
|
|
28
|
+
"react-quill": "^1.3.0",
|
|
29
|
+
"react-redux": "^7.2.0",
|
|
27
30
|
"react-svg-file-zoom-pan": "^1.0.5",
|
|
28
31
|
"react-svg-inline": "^2.1.1",
|
|
29
32
|
"redux": "^4.1.1",
|
|
@@ -42,21 +45,22 @@
|
|
|
42
45
|
"buildbook": "build-storybook -c .storybook -o .out"
|
|
43
46
|
},
|
|
44
47
|
"peerDependencies": {
|
|
45
|
-
"react": "^
|
|
46
|
-
"react-dom": "^
|
|
48
|
+
"react": "^17.0.2",
|
|
49
|
+
"react-dom": "^17.0.2"
|
|
47
50
|
},
|
|
48
51
|
"devDependencies": {
|
|
49
|
-
"@storybook/react": "^
|
|
52
|
+
"@storybook/react": "^5.0.0",
|
|
50
53
|
"babel-cli": "^6.26.0",
|
|
51
54
|
"babel-core": "^6.26.3",
|
|
52
|
-
"eslint-config-airbnb": "^
|
|
53
|
-
"eslint-plugin-import": "^2.
|
|
54
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
55
|
-
"eslint-plugin-react": "^7.
|
|
56
|
-
"react": "^
|
|
57
|
-
"react
|
|
55
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
56
|
+
"eslint-plugin-import": "^2.25.0",
|
|
57
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
58
|
+
"eslint-plugin-react": "^7.28.0",
|
|
59
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
60
|
+
"react": "^17.0.2",
|
|
61
|
+
"react-dom": "^17.0.2",
|
|
58
62
|
"react-scripts": "^2.1.1",
|
|
59
|
-
"react-select": "^
|
|
63
|
+
"react-select": "^4.0.0",
|
|
60
64
|
"redux-logger": "^3.0.6"
|
|
61
65
|
},
|
|
62
66
|
"main": "dist/app.js",
|