@complat/react-spectra-editor 0.11.3 → 0.11.4-beta.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/dist/components/d3_line/line_focus_bk.js +860 -0
- package/dist/components/d3_multi/index_bk.js +240 -0
- package/dist/components/d3_multi/multi_focus_bk.js +550 -0
- package/dist/components/panel/compare_bk.js +370 -0
- package/dist/components/panel/info_bk.js +341 -0
- package/dist/components/panel/multiplicity_bk.js +405 -0
- package/dist/helpers/chem_bk.js +779 -0
- package/dist/helpers/converter_bk.js +106 -0
- package/dist/helpers/format_bk.js +462 -0
- package/dist/index_bk.js +760 -0
- package/dist/layer_content_bk.js +128 -0
- package/dist/layer_prism_bk.js +186 -0
- package/dist/reducers/reducer_edit_peak_bk.js +111 -0
- package/dist/reducers/reducer_integration_bk.js +137 -0
- package/dist/reducers/reducer_jcamp_bk.js +74 -0
- package/dist/reducers/reducer_multiplicity_bk.js +131 -0
- package/dist/reducers/reducer_shift_bk.js +99 -0
- package/dist/sagas/saga_edit_peak_bk.js +84 -0
- package/dist/sagas/saga_multiplicity_bk.js +387 -0
- package/dist/sagas/saga_ui_bk.js +488 -0
- package/package.json +3 -2
|
@@ -0,0 +1,550 @@
|
|
|
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
|
+
var _chem = require('../../helpers/chem');
|
|
32
|
+
|
|
33
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
|
+
|
|
35
|
+
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; } }
|
|
36
|
+
|
|
37
|
+
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); } }
|
|
38
|
+
|
|
39
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
40
|
+
|
|
41
|
+
var MultiFocus = function () {
|
|
42
|
+
function MultiFocus(props) {
|
|
43
|
+
_classCallCheck(this, MultiFocus);
|
|
44
|
+
|
|
45
|
+
var W = props.W,
|
|
46
|
+
H = props.H,
|
|
47
|
+
clickUiTargetAct = props.clickUiTargetAct,
|
|
48
|
+
selectUiSweepAct = props.selectUiSweepAct,
|
|
49
|
+
scrollUiWheelAct = props.scrollUiWheelAct,
|
|
50
|
+
entities = props.entities;
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
this.entities = entities;
|
|
54
|
+
this.jcampIdx = 0;
|
|
55
|
+
this.rootKlass = ".d3Line";
|
|
56
|
+
this.margin = {
|
|
57
|
+
t: 5,
|
|
58
|
+
b: 40,
|
|
59
|
+
l: 60,
|
|
60
|
+
r: 5
|
|
61
|
+
};
|
|
62
|
+
this.w = W - this.margin.l - this.margin.r;
|
|
63
|
+
this.h = H - this.margin.t - this.margin.b;
|
|
64
|
+
this.clickUiTargetAct = clickUiTargetAct;
|
|
65
|
+
this.selectUiSweepAct = selectUiSweepAct;
|
|
66
|
+
this.scrollUiWheelAct = scrollUiWheelAct;
|
|
67
|
+
this.brush = d3.brush();
|
|
68
|
+
this.brushX = d3.brushX();
|
|
69
|
+
|
|
70
|
+
this.axis = null;
|
|
71
|
+
this.path = null;
|
|
72
|
+
this.grid = null;
|
|
73
|
+
this.tags = null;
|
|
74
|
+
this.data = [];
|
|
75
|
+
this.otherLineData = [];
|
|
76
|
+
this.pathColor = 'steelblue';
|
|
77
|
+
this.dataPks = [];
|
|
78
|
+
this.dataPeckers = [];
|
|
79
|
+
this.tTrEndPts = null;
|
|
80
|
+
this.tSfPeaks = null;
|
|
81
|
+
this.root = null;
|
|
82
|
+
this.svg = null;
|
|
83
|
+
this.axisCall = (0, _init.InitAxisCall)(5);
|
|
84
|
+
this.pathCall = null;
|
|
85
|
+
this.tip = null;
|
|
86
|
+
this.factor = 0.125;
|
|
87
|
+
this.currentExtent = null;
|
|
88
|
+
this.shouldUpdate = {};
|
|
89
|
+
// this.freq = false;
|
|
90
|
+
this.layout = _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY;
|
|
91
|
+
|
|
92
|
+
this.getShouldUpdate = this.getShouldUpdate.bind(this);
|
|
93
|
+
this.resetShouldUpdate = this.resetShouldUpdate.bind(this);
|
|
94
|
+
this.setTip = this.setTip.bind(this);
|
|
95
|
+
this.setDataParams = this.setDataParams.bind(this);
|
|
96
|
+
this.create = this.create.bind(this);
|
|
97
|
+
this.update = this.update.bind(this);
|
|
98
|
+
this.setConfig = this.setConfig.bind(this);
|
|
99
|
+
this.drawLine = this.drawLine.bind(this);
|
|
100
|
+
this.drawOtherLines = this.drawOtherLines.bind(this);
|
|
101
|
+
this.drawGrid = this.drawGrid.bind(this);
|
|
102
|
+
this.drawPeaks = this.drawPeaks.bind(this);
|
|
103
|
+
this.onClickTarget = this.onClickTarget.bind(this);
|
|
104
|
+
this.mergedPeaks = this.mergedPeaks.bind(this);
|
|
105
|
+
this.setDataPecker = this.setDataPecker.bind(this);
|
|
106
|
+
this.drawPeckers = this.drawPeckers.bind(this);
|
|
107
|
+
this.onClickPecker = this.onClickPecker.bind(this);
|
|
108
|
+
this.isFirefox = typeof InstallTrigger !== 'undefined';
|
|
109
|
+
this.cyclicvoltaSt = null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
_createClass(MultiFocus, [{
|
|
113
|
+
key: 'getShouldUpdate',
|
|
114
|
+
value: function getShouldUpdate(nextEpSt) {
|
|
115
|
+
var _shouldUpdate = this.shouldUpdate,
|
|
116
|
+
prevXt = _shouldUpdate.prevXt,
|
|
117
|
+
prevYt = _shouldUpdate.prevYt,
|
|
118
|
+
prevEpSt = _shouldUpdate.prevEpSt,
|
|
119
|
+
prevLySt = _shouldUpdate.prevLySt,
|
|
120
|
+
prevTePt = _shouldUpdate.prevTePt,
|
|
121
|
+
prevDtPk = _shouldUpdate.prevDtPk,
|
|
122
|
+
prevSfPk = _shouldUpdate.prevSfPk,
|
|
123
|
+
prevData = _shouldUpdate.prevData;
|
|
124
|
+
|
|
125
|
+
var _TfRescale = (0, _compass.TfRescale)(this),
|
|
126
|
+
xt = _TfRescale.xt,
|
|
127
|
+
yt = _TfRescale.yt;
|
|
128
|
+
|
|
129
|
+
var sameXY = xt(1.1) === prevXt && prevYt === yt(1.1);
|
|
130
|
+
var sameEpSt = prevEpSt === nextEpSt;
|
|
131
|
+
var sameLySt = prevLySt === this.layout;
|
|
132
|
+
var sameTePt = prevTePt === this.tTrEndPts.length;
|
|
133
|
+
var sameDtPk = prevDtPk === this.dataPks.length;
|
|
134
|
+
var sameSfPk = prevSfPk === this.tSfPeaks.length;
|
|
135
|
+
var sameData = prevData === this.data.length;
|
|
136
|
+
this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
|
|
137
|
+
sameXY: sameXY, sameEpSt: sameEpSt, sameLySt: sameLySt, // eslint-disable-line
|
|
138
|
+
sameTePt: sameTePt, sameDtPk: sameDtPk, sameSfPk: sameSfPk, sameData: sameData // eslint-disable-line
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}, {
|
|
142
|
+
key: 'resetShouldUpdate',
|
|
143
|
+
value: function resetShouldUpdate(prevEpSt) {
|
|
144
|
+
var _TfRescale2 = (0, _compass.TfRescale)(this),
|
|
145
|
+
xt = _TfRescale2.xt,
|
|
146
|
+
yt = _TfRescale2.yt;
|
|
147
|
+
|
|
148
|
+
var prevXt = xt(1.1);
|
|
149
|
+
var prevYt = yt(1.1);
|
|
150
|
+
var prevTePt = this.tTrEndPts.length;
|
|
151
|
+
var prevDtPk = this.dataPks.length;
|
|
152
|
+
var prevSfPk = this.tSfPeaks.length;
|
|
153
|
+
var prevData = this.data.length;
|
|
154
|
+
var prevLySt = this.layout;
|
|
155
|
+
this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
|
|
156
|
+
prevXt: prevXt, prevYt: prevYt, prevEpSt: prevEpSt, prevLySt: prevLySt, // eslint-disable-line
|
|
157
|
+
prevTePt: prevTePt, prevDtPk: prevDtPk, prevSfPk: prevSfPk, prevData: prevData // eslint-disable-line
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: 'setTip',
|
|
162
|
+
value: function setTip() {
|
|
163
|
+
this.tip = (0, _init.InitTip)();
|
|
164
|
+
this.root.call(this.tip);
|
|
165
|
+
}
|
|
166
|
+
}, {
|
|
167
|
+
key: 'setDataParams',
|
|
168
|
+
value: function setDataParams(peaks, tTrEndPts, tSfPeaks, layout, cyclicvoltaSt) {
|
|
169
|
+
var _this = this;
|
|
170
|
+
|
|
171
|
+
var jcampIdx = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
172
|
+
|
|
173
|
+
this.jcampIdx = jcampIdx;
|
|
174
|
+
this.data = [];
|
|
175
|
+
this.otherLineData = [];
|
|
176
|
+
this.entities.forEach(function (entry, idx) {
|
|
177
|
+
var topic = entry.topic,
|
|
178
|
+
feature = entry.feature,
|
|
179
|
+
color = entry.color;
|
|
180
|
+
|
|
181
|
+
var currData = (0, _chem.convertTopic)(topic, layout, feature, 0);
|
|
182
|
+
if (idx === _this.jcampIdx) {
|
|
183
|
+
_this.data = [].concat(_toConsumableArray(currData));
|
|
184
|
+
_this.pathColor = color;
|
|
185
|
+
} else {
|
|
186
|
+
_this.otherLineData.push({ data: currData, color: color });
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
this.dataPks = [].concat(_toConsumableArray(peaks));
|
|
191
|
+
this.tTrEndPts = tTrEndPts;
|
|
192
|
+
this.tSfPeaks = tSfPeaks;
|
|
193
|
+
this.layout = layout;
|
|
194
|
+
this.cyclicvoltaSt = cyclicvoltaSt;
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
key: 'updatePathCall',
|
|
198
|
+
value: function updatePathCall(xt, yt) {
|
|
199
|
+
this.pathCall = d3.line().x(function (d) {
|
|
200
|
+
return xt(d.x);
|
|
201
|
+
}).y(function (d) {
|
|
202
|
+
return yt(d.y);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
key: 'setConfig',
|
|
207
|
+
value: function setConfig(sweepExtentSt) {
|
|
208
|
+
// Domain Calculate
|
|
209
|
+
var _ref = sweepExtentSt || { xExtent: false, yExtent: false },
|
|
210
|
+
xExtent = _ref.xExtent,
|
|
211
|
+
yExtent = _ref.yExtent;
|
|
212
|
+
|
|
213
|
+
if (!xExtent || !yExtent) {
|
|
214
|
+
var allData = [].concat(_toConsumableArray(this.data));
|
|
215
|
+
if (this.otherLineData) {
|
|
216
|
+
this.otherLineData.forEach(function (lineData) {
|
|
217
|
+
allData = [].concat(_toConsumableArray(allData), _toConsumableArray(lineData.data));
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
var xes = d3.extent(allData, function (d) {
|
|
222
|
+
return d.x;
|
|
223
|
+
}).sort(function (a, b) {
|
|
224
|
+
return a - b;
|
|
225
|
+
});
|
|
226
|
+
xExtent = { xL: xes[0], xU: xes[1] };
|
|
227
|
+
var btm = d3.min(allData, function (d) {
|
|
228
|
+
return d.y;
|
|
229
|
+
});
|
|
230
|
+
var top = d3.max(allData, function (d) {
|
|
231
|
+
return d.y;
|
|
232
|
+
});
|
|
233
|
+
var height = top - btm;
|
|
234
|
+
yExtent = {
|
|
235
|
+
yL: btm - this.factor * height,
|
|
236
|
+
yU: top + this.factor * height
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
this.scales.x.domain([xExtent.xL, xExtent.xU]);
|
|
241
|
+
this.scales.y.domain([yExtent.yL, yExtent.yU]);
|
|
242
|
+
|
|
243
|
+
// rescale for zoom
|
|
244
|
+
|
|
245
|
+
var _TfRescale3 = (0, _compass.TfRescale)(this),
|
|
246
|
+
xt = _TfRescale3.xt,
|
|
247
|
+
yt = _TfRescale3.yt;
|
|
248
|
+
|
|
249
|
+
// Axis Call
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
this.axisCall.x.scale(xt);
|
|
253
|
+
this.axisCall.y.scale(yt);
|
|
254
|
+
|
|
255
|
+
this.currentExtent = { xExtent: xExtent, yExtent: yExtent };
|
|
256
|
+
}
|
|
257
|
+
}, {
|
|
258
|
+
key: 'drawLine',
|
|
259
|
+
value: function drawLine() {
|
|
260
|
+
var _TfRescale4 = (0, _compass.TfRescale)(this),
|
|
261
|
+
xt = _TfRescale4.xt,
|
|
262
|
+
yt = _TfRescale4.yt;
|
|
263
|
+
|
|
264
|
+
this.updatePathCall(xt, yt);
|
|
265
|
+
this.path.attr('d', this.pathCall(this.data));
|
|
266
|
+
this.path.style('stroke', this.pathColor);
|
|
267
|
+
}
|
|
268
|
+
}, {
|
|
269
|
+
key: 'drawOtherLines',
|
|
270
|
+
value: function drawOtherLines(layout) {
|
|
271
|
+
var _this2 = this;
|
|
272
|
+
|
|
273
|
+
d3.selectAll('.line-clip-compare').remove();
|
|
274
|
+
if (!this.otherLineData) return null;
|
|
275
|
+
this.otherLineData.forEach(function (entry, idx) {
|
|
276
|
+
var data = entry.data,
|
|
277
|
+
color = entry.color;
|
|
278
|
+
|
|
279
|
+
var pathColor = color ? color : _format2.default.mutiEntitiesColors(idx);
|
|
280
|
+
var path = (0, _mount.MountComparePath)(_this2, pathColor, idx, 0.4);
|
|
281
|
+
path.attr('d', _this2.pathCall(data));
|
|
282
|
+
});
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
}, {
|
|
286
|
+
key: 'drawGrid',
|
|
287
|
+
value: function drawGrid() {
|
|
288
|
+
var sameXY = this.shouldUpdate.sameXY;
|
|
289
|
+
|
|
290
|
+
if (sameXY) return;
|
|
291
|
+
|
|
292
|
+
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');
|
|
293
|
+
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');
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
key: 'onClickTarget',
|
|
297
|
+
value: function onClickTarget(data) {
|
|
298
|
+
d3.event.stopPropagation();
|
|
299
|
+
d3.event.preventDefault();
|
|
300
|
+
var onPeak = true;
|
|
301
|
+
var spectraList = this.cyclicvoltaSt.spectraList;
|
|
302
|
+
|
|
303
|
+
var spectra = spectraList[this.jcampIdx];
|
|
304
|
+
var voltammetryPeakIdx = spectra.selectedIdx;
|
|
305
|
+
this.clickUiTargetAct(data, onPeak, voltammetryPeakIdx, this.jcampIdx);
|
|
306
|
+
}
|
|
307
|
+
}, {
|
|
308
|
+
key: 'onClickPecker',
|
|
309
|
+
value: function onClickPecker(data) {
|
|
310
|
+
d3.event.stopPropagation();
|
|
311
|
+
d3.event.preventDefault();
|
|
312
|
+
var onPecker = true;
|
|
313
|
+
var spectraList = this.cyclicvoltaSt.spectraList;
|
|
314
|
+
|
|
315
|
+
var spectra = spectraList[this.jcampIdx];
|
|
316
|
+
var voltammetryPeakIdx = spectra.selectedIdx;
|
|
317
|
+
this.clickUiTargetAct(data, false, voltammetryPeakIdx, this.jcampIdx, onPecker);
|
|
318
|
+
}
|
|
319
|
+
}, {
|
|
320
|
+
key: 'mergedPeaks',
|
|
321
|
+
value: function mergedPeaks(editPeakSt) {
|
|
322
|
+
if (!editPeakSt) return this.dataPks;
|
|
323
|
+
var spectraList = this.cyclicvoltaSt.spectraList;
|
|
324
|
+
|
|
325
|
+
var spectra = spectraList[this.jcampIdx];
|
|
326
|
+
if (spectra) {
|
|
327
|
+
this.dataPks = [];
|
|
328
|
+
this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt, spectra.list);
|
|
329
|
+
} else {
|
|
330
|
+
this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt, []);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return this.dataPks;
|
|
334
|
+
}
|
|
335
|
+
}, {
|
|
336
|
+
key: 'setDataPecker',
|
|
337
|
+
value: function setDataPecker() {
|
|
338
|
+
var spectraList = this.cyclicvoltaSt.spectraList;
|
|
339
|
+
|
|
340
|
+
var spectra = spectraList[this.jcampIdx];
|
|
341
|
+
if (spectra) {
|
|
342
|
+
this.dataPeckers = (0, _converter.PeckersEdit)(spectra.list);
|
|
343
|
+
}
|
|
344
|
+
return this.dataPeckers;
|
|
345
|
+
}
|
|
346
|
+
}, {
|
|
347
|
+
key: 'drawPeaks',
|
|
348
|
+
value: function drawPeaks(editPeakSt) {
|
|
349
|
+
var _this3 = this;
|
|
350
|
+
|
|
351
|
+
var _shouldUpdate2 = this.shouldUpdate,
|
|
352
|
+
sameXY = _shouldUpdate2.sameXY,
|
|
353
|
+
sameEpSt = _shouldUpdate2.sameEpSt,
|
|
354
|
+
sameDtPk = _shouldUpdate2.sameDtPk,
|
|
355
|
+
sameSfPk = _shouldUpdate2.sameSfPk;
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
if (!_format2.default.isCyclicVoltaLayout(this.layout) && sameXY && sameEpSt && sameDtPk && sameSfPk) return;
|
|
359
|
+
|
|
360
|
+
// rescale for zoom
|
|
361
|
+
|
|
362
|
+
var _TfRescale5 = (0, _compass.TfRescale)(this),
|
|
363
|
+
xt = _TfRescale5.xt,
|
|
364
|
+
yt = _TfRescale5.yt;
|
|
365
|
+
|
|
366
|
+
var dPks = this.mergedPeaks(editPeakSt);
|
|
367
|
+
|
|
368
|
+
var mpp = this.tags.pPath.selectAll('path').data(dPks);
|
|
369
|
+
mpp.exit().attr('class', 'exit').remove();
|
|
370
|
+
|
|
371
|
+
var linePath = [{ x: -0.5, y: 10 }, { x: -0.5, y: -20 }, { x: 0.5, y: -20 }, { x: 0.5, y: 10 }];
|
|
372
|
+
var lineSymbol = d3.line().x(function (d) {
|
|
373
|
+
return d.x;
|
|
374
|
+
}).y(function (d) {
|
|
375
|
+
return d.y;
|
|
376
|
+
})(linePath);
|
|
377
|
+
|
|
378
|
+
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) {
|
|
379
|
+
return 'mpp' + Math.round(1000 * d.x);
|
|
380
|
+
}).attr('transform', function (d) {
|
|
381
|
+
return 'translate(' + xt(d.x) + ', ' + yt(d.y) + ')';
|
|
382
|
+
}).on('mouseover', function (d, i, n) {
|
|
383
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '1.0');
|
|
384
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', 'blue');
|
|
385
|
+
var tipParams = { d: d, layout: _this3.layout };
|
|
386
|
+
_this3.tip.show(tipParams, n[i]);
|
|
387
|
+
}).on('mouseout', function (d, i, n) {
|
|
388
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '0.0');
|
|
389
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', 'red');
|
|
390
|
+
var tipParams = { d: d, layout: _this3.layout };
|
|
391
|
+
_this3.tip.hide(tipParams, n[i]);
|
|
392
|
+
}).on('click', function (d) {
|
|
393
|
+
return _this3.onClickTarget(d);
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
var ignoreRef = _format2.default.isHplcUvVisLayout(this.layout);
|
|
397
|
+
if (ignoreRef) {
|
|
398
|
+
var bpTxt = this.tags.bpTxt.selectAll('text').data(dPks);
|
|
399
|
+
bpTxt.exit().attr('class', 'exit').remove();
|
|
400
|
+
|
|
401
|
+
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) {
|
|
402
|
+
return 'mpp' + Math.round(1000 * d.x);
|
|
403
|
+
}).text(function (d) {
|
|
404
|
+
return d.x.toFixed(2);
|
|
405
|
+
}).attr('transform', function (d) {
|
|
406
|
+
return 'translate(' + xt(d.x) + ', ' + (yt(d.y) - 25) + ')';
|
|
407
|
+
}).on('click', function (d) {
|
|
408
|
+
return _this3.onClickTarget(d);
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}, {
|
|
413
|
+
key: 'drawPeckers',
|
|
414
|
+
value: function drawPeckers() {
|
|
415
|
+
var _this4 = this;
|
|
416
|
+
|
|
417
|
+
var _shouldUpdate3 = this.shouldUpdate,
|
|
418
|
+
sameXY = _shouldUpdate3.sameXY,
|
|
419
|
+
sameEpSt = _shouldUpdate3.sameEpSt,
|
|
420
|
+
sameDtPk = _shouldUpdate3.sameDtPk,
|
|
421
|
+
sameSfPk = _shouldUpdate3.sameSfPk;
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
if (!_format2.default.isCyclicVoltaLayout(this.layout) && sameXY && sameEpSt && sameDtPk && sameSfPk) return;
|
|
425
|
+
|
|
426
|
+
// rescale for zoom
|
|
427
|
+
|
|
428
|
+
var _TfRescale6 = (0, _compass.TfRescale)(this),
|
|
429
|
+
xt = _TfRescale6.xt,
|
|
430
|
+
yt = _TfRescale6.yt;
|
|
431
|
+
|
|
432
|
+
var dPks = this.setDataPecker();
|
|
433
|
+
|
|
434
|
+
var mpp = this.tags.peckerPath.selectAll('path').data(dPks);
|
|
435
|
+
mpp.exit().attr('class', 'exit').remove();
|
|
436
|
+
|
|
437
|
+
var linePath = [{ x: -0.5, y: 10 }, { x: -0.5, y: -20 }, { x: 0.5, y: -20 }, { x: 0.5, y: 10 }];
|
|
438
|
+
var lineSymbol = d3.line().x(function (d) {
|
|
439
|
+
return d.x;
|
|
440
|
+
}).y(function (d) {
|
|
441
|
+
return d.y;
|
|
442
|
+
})(linePath);
|
|
443
|
+
|
|
444
|
+
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) {
|
|
445
|
+
return 'mpp' + Math.round(1000 * d.x);
|
|
446
|
+
}).attr('transform', function (d) {
|
|
447
|
+
return 'translate(' + xt(d.x) + ', ' + yt(d.y) + ')';
|
|
448
|
+
}).on('mouseover', function (d, i, n) {
|
|
449
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '1.0');
|
|
450
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', 'blue');
|
|
451
|
+
var tipParams = { d: d, layout: _this4.layout };
|
|
452
|
+
_this4.tip.show(tipParams, n[i]);
|
|
453
|
+
}).on('mouseout', function (d, i, n) {
|
|
454
|
+
d3.select('#mpp' + Math.round(1000 * d.x)).attr('stroke-opacity', '0.0');
|
|
455
|
+
d3.select('#bpt' + Math.round(1000 * d.x)).style('fill', '#228B22');
|
|
456
|
+
var tipParams = { d: d, layout: _this4.layout };
|
|
457
|
+
_this4.tip.hide(tipParams, n[i]);
|
|
458
|
+
}).on('click', function (d) {
|
|
459
|
+
return _this4.onClickPecker(d);
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
}, {
|
|
463
|
+
key: 'create',
|
|
464
|
+
value: function create(_ref2) {
|
|
465
|
+
var curveSt = _ref2.curveSt,
|
|
466
|
+
filterSeed = _ref2.filterSeed,
|
|
467
|
+
filterPeak = _ref2.filterPeak,
|
|
468
|
+
tTrEndPts = _ref2.tTrEndPts,
|
|
469
|
+
tSfPeaks = _ref2.tSfPeaks,
|
|
470
|
+
editPeakSt = _ref2.editPeakSt,
|
|
471
|
+
layoutSt = _ref2.layoutSt,
|
|
472
|
+
sweepExtentSt = _ref2.sweepExtentSt,
|
|
473
|
+
isUiNoBrushSt = _ref2.isUiNoBrushSt,
|
|
474
|
+
cyclicvoltaSt = _ref2.cyclicvoltaSt;
|
|
475
|
+
|
|
476
|
+
this.svg = d3.select(this.rootKlass).select('.d3Svg');
|
|
477
|
+
(0, _mount.MountMainFrame)(this, 'focus');
|
|
478
|
+
(0, _mount.MountClip)(this);
|
|
479
|
+
|
|
480
|
+
var curveIdx = curveSt.curveIdx;
|
|
481
|
+
|
|
482
|
+
var jcampIdx = curveIdx;
|
|
483
|
+
|
|
484
|
+
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
|
|
485
|
+
this.scales = (0, _init.InitScale)(this, false);
|
|
486
|
+
this.setTip();
|
|
487
|
+
this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
|
|
488
|
+
(0, _compass.MountCompass)(this);
|
|
489
|
+
|
|
490
|
+
this.axis = (0, _mount.MountAxis)(this);
|
|
491
|
+
this.path = (0, _mount.MountPath)(this, this.pathColor);
|
|
492
|
+
this.grid = (0, _mount.MountGrid)(this);
|
|
493
|
+
this.tags = (0, _mount.MountTags)(this);
|
|
494
|
+
(0, _mount.MountAxisLabelX)(this);
|
|
495
|
+
(0, _mount.MountAxisLabelY)(this);
|
|
496
|
+
|
|
497
|
+
if (this.data && this.data.length > 0) {
|
|
498
|
+
this.setConfig(sweepExtentSt);
|
|
499
|
+
this.drawLine();
|
|
500
|
+
this.drawGrid();
|
|
501
|
+
this.drawOtherLines(layoutSt);
|
|
502
|
+
this.drawPeaks(editPeakSt);
|
|
503
|
+
this.drawPeckers();
|
|
504
|
+
}
|
|
505
|
+
(0, _brush2.default)(this, false, isUiNoBrushSt);
|
|
506
|
+
this.resetShouldUpdate(editPeakSt);
|
|
507
|
+
}
|
|
508
|
+
}, {
|
|
509
|
+
key: 'update',
|
|
510
|
+
value: function update(_ref3) {
|
|
511
|
+
var entities = _ref3.entities,
|
|
512
|
+
curveSt = _ref3.curveSt,
|
|
513
|
+
filterSeed = _ref3.filterSeed,
|
|
514
|
+
filterPeak = _ref3.filterPeak,
|
|
515
|
+
tTrEndPts = _ref3.tTrEndPts,
|
|
516
|
+
tSfPeaks = _ref3.tSfPeaks,
|
|
517
|
+
editPeakSt = _ref3.editPeakSt,
|
|
518
|
+
layoutSt = _ref3.layoutSt,
|
|
519
|
+
sweepExtentSt = _ref3.sweepExtentSt,
|
|
520
|
+
isUiNoBrushSt = _ref3.isUiNoBrushSt,
|
|
521
|
+
cyclicvoltaSt = _ref3.cyclicvoltaSt;
|
|
522
|
+
|
|
523
|
+
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
|
|
524
|
+
this.scales = (0, _init.InitScale)(this, false);
|
|
525
|
+
|
|
526
|
+
var curveIdx = curveSt.curveIdx;
|
|
527
|
+
|
|
528
|
+
var jcampIdx = curveIdx;
|
|
529
|
+
this.entities = entities;
|
|
530
|
+
|
|
531
|
+
this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
|
|
532
|
+
|
|
533
|
+
if (this.data && this.data.length > 0) {
|
|
534
|
+
this.setConfig(sweepExtentSt);
|
|
535
|
+
this.getShouldUpdate(editPeakSt);
|
|
536
|
+
this.drawLine();
|
|
537
|
+
this.drawGrid();
|
|
538
|
+
this.drawOtherLines(layoutSt);
|
|
539
|
+
this.drawPeaks(editPeakSt);
|
|
540
|
+
this.drawPeckers();
|
|
541
|
+
}
|
|
542
|
+
(0, _brush2.default)(this, false, isUiNoBrushSt);
|
|
543
|
+
this.resetShouldUpdate(editPeakSt);
|
|
544
|
+
}
|
|
545
|
+
}]);
|
|
546
|
+
|
|
547
|
+
return MultiFocus;
|
|
548
|
+
}();
|
|
549
|
+
|
|
550
|
+
exports.default = MultiFocus;
|