Skip to content

Commit 168ada3

Browse files
fix: fixed shift referent for multi spectra (#230)
1 parent 1a6a24d commit 168ada3

File tree

7 files changed

+3286
-1985
lines changed

7 files changed

+3286
-1985
lines changed

dist/components/d3_multi/multi_focus.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var _integration = require("../../helpers/integration");
1919
var _multiplicity_calc = require("../../helpers/multiplicity_calc");
2020
var _calc = require("../../helpers/calc");
2121
/* eslint-disable no-unused-vars, prefer-object-spread, no-mixed-operators,
22-
no-unneeded-ternary, arrow-body-style */
22+
no-unneeded-ternary, arrow-body-style, max-len */
2323

2424
const d3 = require('d3');
2525
class MultiFocus {
@@ -158,8 +158,8 @@ class MultiFocus {
158158
this.tip = (0, _init.InitTip)();
159159
this.root.call(this.tip);
160160
}
161-
setDataParams(peaks, tTrEndPts, tSfPeaks, layout, cyclicvoltaSt) {
162-
let jcampIdx = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
161+
setDataParams(filterSeed, peaks, tTrEndPts, tSfPeaks, layout, cyclicvoltaSt) {
162+
let jcampIdx = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
163163
this.data = [];
164164
this.otherLineData = [];
165165
let filterSubLayoutValue = null;
@@ -170,8 +170,11 @@ class MultiFocus {
170170
color
171171
} = entry;
172172
const offset = (0, _chem.GetCyclicVoltaPreviousShift)(cyclicvoltaSt, jcampIdx);
173-
const currData = (0, _chem.convertTopic)(topic, layout, feature, offset);
173+
let currData = (0, _chem.convertTopic)(topic, layout, feature, offset);
174174
if (idx === jcampIdx) {
175+
if (!_format.default.isCyclicVoltaLayout(layout)) {
176+
currData = filterSeed;
177+
}
175178
this.data = [...currData];
176179
this.pathColor = color;
177180
filterSubLayoutValue = _format.default.isSECLayout(layout) ? feature.xUnit : feature.yUnit;
@@ -835,7 +838,7 @@ class MultiFocus {
835838
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
836839
this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
837840
this.setTip();
838-
this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
841+
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
839842
(0, _compass.MountCompass)(this);
840843
this.axis = (0, _mount.MountAxis)(this);
841844
this.path = (0, _mount.MountPath)(this, this.pathColor);
@@ -885,7 +888,7 @@ class MultiFocus {
885888
const jcampIdx = curveIdx;
886889
this.isShowAllCurves = isShowAllCurve;
887890
this.entities = entities;
888-
this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
891+
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
889892
if (this.data && this.data.length > 0) {
890893
this.setConfig(sweepExtentSt);
891894
this.getShouldUpdate(editPeakSt);

dist/reducers/reducer_curve.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var _action_type = require("../constants/action_type");
99
var _extractParams = require("../helpers/extractParams");
1010
var _chem = require("../helpers/chem");
1111
var _format = _interopRequireDefault(require("../helpers/format"));
12-
/* eslint-disable prefer-object-spread, default-param-last */
12+
/* eslint-disable prefer-object-spread, default-param-last, max-len */
1313

1414
const initialState = {
1515
listCurves: [],
@@ -26,7 +26,8 @@ const setAllCurves = (state, action) => {
2626
topic,
2727
feature,
2828
hasEdit,
29-
integration
29+
integration,
30+
multiplicity
3031
} = (0, _extractParams.extractParams)(entity, {
3132
isEdit: true
3233
});
@@ -42,6 +43,7 @@ const setAllCurves = (state, action) => {
4243
feature,
4344
hasEdit,
4445
integration,
46+
multiplicity,
4547
maxminPeak,
4648
color,
4749
curveIdx: idx

dist/sagas/saga_multi_entities.js

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var _list_layout = require("../constants/list_layout");
1212
const getLayoutSt = state => state.layout;
1313
const getCurveSt = state => state.curve;
1414
const getIntegrationSt = state => state.integration.present;
15+
const getMultiplicitySt = state => state.multiplicity.present;
1516
function getMaxMinPeak(curve) {
1617
return curve.maxminPeak;
1718
}
@@ -115,31 +116,51 @@ function* setInitIntegrations(action) {
115116
if (listCurves) {
116117
for (let index = 0; index < listCurves.length; index++) {
117118
const integationSt = yield (0, _effects.select)(getIntegrationSt);
119+
const multiplicitySt = yield (0, _effects.select)(getMultiplicitySt);
118120
const curve = listCurves[index];
119121
const {
120122
integration,
123+
multiplicity,
121124
simulation
122125
} = curve;
123-
const {
124-
integrations
125-
} = integationSt;
126-
const newArrIntegration = [...integrations];
127-
if (index < newArrIntegration.length) {
128-
newArrIntegration[index] = integration;
129-
} else {
130-
newArrIntegration.push(integration);
131-
}
132-
const payload = Object.assign({}, integationSt, {
133-
integrations: newArrIntegration,
134-
selectedIdx: index
135-
}); // eslint-disable-line
136-
137126
if (integration) {
127+
const {
128+
integrations
129+
} = integationSt;
130+
const newArrIntegration = [...integrations];
131+
if (index < newArrIntegration.length) {
132+
newArrIntegration[index] = integration;
133+
} else {
134+
newArrIntegration.push(integration);
135+
}
136+
const payload = Object.assign({}, integationSt, {
137+
integrations: newArrIntegration,
138+
selectedIdx: index
139+
}); // eslint-disable-line
138140
yield (0, _effects.put)({
139141
type: _action_type.INTEGRATION.RESET_ALL_RDC,
140142
payload
141143
});
142144
}
145+
if (multiplicity) {
146+
const {
147+
multiplicities
148+
} = multiplicitySt;
149+
const newArrMultiplicities = [...multiplicities];
150+
if (index < newArrMultiplicities.length) {
151+
newArrMultiplicities[index] = multiplicity;
152+
} else {
153+
newArrMultiplicities.push(multiplicity);
154+
}
155+
const payload = Object.assign({}, multiplicitySt, {
156+
multiplicities: newArrMultiplicities,
157+
selectedIdx: index
158+
}); // eslint-disable-line
159+
yield (0, _effects.put)({
160+
type: _action_type.MULTIPLICITY.RESET_ALL_RDC,
161+
payload
162+
});
163+
}
143164
if (simulation) {
144165
yield (0, _effects.put)({
145166
type: _action_type.SIMULATION.RESET_ALL_RDC,

0 commit comments

Comments
 (0)