@complat/react-spectra-editor 1.0.0-rc2 → 1.0.0-rc20.patch-1

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.
Files changed (202) hide show
  1. package/README.md +16 -0
  2. package/dist/__tests__/fixtures/aif_jcamp_1.js +136 -0
  3. package/dist/__tests__/fixtures/aif_jcamp_2.js +122 -0
  4. package/dist/__tests__/fixtures/backup/nmr1h_a.js +3518 -0
  5. package/dist/__tests__/fixtures/backup/xrd_jcamp_1.js +10705 -0
  6. package/dist/__tests__/fixtures/cds_jcamp.js +861 -0
  7. package/dist/__tests__/fixtures/compare_ir_1_jcamp.js +585 -0
  8. package/dist/__tests__/fixtures/compare_ir_2_jcamp.js +515 -0
  9. package/dist/__tests__/fixtures/compare_uv_vis_jcamp.js +640 -0
  10. package/dist/__tests__/fixtures/cyclic_voltammetry_1.js +778 -0
  11. package/dist/__tests__/fixtures/cyclic_voltammetry_2.js +758 -0
  12. package/dist/__tests__/fixtures/cyclic_voltammetry_3.js +759 -0
  13. package/dist/__tests__/fixtures/dls_acf_jcamp.js +148 -0
  14. package/dist/__tests__/fixtures/dls_intensity_jcamp.js +151 -0
  15. package/dist/__tests__/fixtures/emissions_jcamp.js +883 -0
  16. package/dist/__tests__/fixtures/hplc_uvvis_jcamp.js +638 -0
  17. package/dist/__tests__/fixtures/hplc_uvvis_jcamp_2.js +221 -0
  18. package/dist/__tests__/fixtures/ir_jcamp.js +148 -0
  19. package/dist/__tests__/fixtures/ir_result.js +46 -0
  20. package/dist/__tests__/fixtures/ir_svg.js +8 -0
  21. package/dist/__tests__/fixtures/ms_jcamp.js +64 -0
  22. package/dist/__tests__/fixtures/nmr13c_dept_jcamp.js +3543 -0
  23. package/dist/__tests__/fixtures/nmr13c_jcamp.js +1229 -0
  24. package/dist/__tests__/fixtures/nmr15n_jcamp.js +7177 -0
  25. package/dist/__tests__/fixtures/nmr19f_jcamp.js +6560 -0
  26. package/dist/__tests__/fixtures/nmr1h_2_jcamp.js +2005 -0
  27. package/dist/__tests__/fixtures/nmr1h_jcamp.js +4516 -0
  28. package/dist/__tests__/fixtures/nmr29si_jcamp.js +3029 -0
  29. package/dist/__tests__/fixtures/nmr31p_jcamp.js +3418 -0
  30. package/dist/__tests__/fixtures/nmr_result.js +68 -0
  31. package/dist/__tests__/fixtures/nmr_svg.js +8 -0
  32. package/dist/__tests__/fixtures/phenylalanin.js +142 -0
  33. package/dist/__tests__/fixtures/qDescValue.js +65 -0
  34. package/dist/__tests__/fixtures/raman_jcamp.js +410 -0
  35. package/dist/__tests__/fixtures/sec_1_jcamp.js +425 -0
  36. package/dist/__tests__/fixtures/sec_2_jcamp.js +407 -0
  37. package/dist/__tests__/fixtures/sec_3_jcamp.js +408 -0
  38. package/dist/__tests__/fixtures/sec_4_jcamp.js +407 -0
  39. package/dist/__tests__/fixtures/tga_jcamp.js +4157 -0
  40. package/dist/__tests__/fixtures/uv_vis_jcamp.js +249 -0
  41. package/dist/__tests__/fixtures/xrd_jcamp_1.js +436 -0
  42. package/dist/__tests__/fixtures/xrd_jcamp_2.js +955 -0
  43. package/dist/__tests__/fixtures/xrd_jcamp_3.js +1871 -0
  44. package/dist/__tests__/units/components/panel/graph_selection.test.js +72 -0
  45. package/dist/__tests__/units/components/panel/peaks.test.js +87 -0
  46. package/dist/actions/curve.js +15 -14
  47. package/dist/actions/cyclic_voltammetry.js +40 -60
  48. package/dist/actions/edit_peak.js +8 -12
  49. package/dist/actions/forecast.js +16 -24
  50. package/dist/actions/integration.js +12 -18
  51. package/dist/actions/jcamp.js +16 -24
  52. package/dist/actions/layout.js +4 -6
  53. package/dist/actions/manager.js +20 -30
  54. package/dist/actions/meta.js +4 -6
  55. package/dist/actions/multiplicity.js +24 -36
  56. package/dist/actions/scan.js +12 -18
  57. package/dist/actions/shift.js +8 -12
  58. package/dist/actions/status.js +12 -18
  59. package/dist/actions/submit.js +16 -24
  60. package/dist/actions/threshold.js +20 -30
  61. package/dist/actions/ui.js +25 -31
  62. package/dist/actions/wavelength.js +4 -6
  63. package/dist/app.js +25 -23
  64. package/dist/components/cmd_bar/01_viewer.js +24 -34
  65. package/dist/components/cmd_bar/02_zoom.js +18 -28
  66. package/dist/components/cmd_bar/03_peak.js +50 -66
  67. package/dist/components/cmd_bar/04_integration.js +70 -84
  68. package/dist/components/cmd_bar/05_multiplicity.js +42 -56
  69. package/dist/components/cmd_bar/06_undo_redo.js +22 -36
  70. package/dist/components/cmd_bar/07_pecker.js +24 -34
  71. package/dist/components/cmd_bar/common.js +11 -7
  72. package/dist/components/cmd_bar/index.js +17 -23
  73. package/dist/components/cmd_bar/r01_layout.js +79 -56
  74. package/dist/components/cmd_bar/r02_scan.js +70 -87
  75. package/dist/components/cmd_bar/r03_threshold.js +54 -68
  76. package/dist/components/cmd_bar/r04_submit.js +71 -83
  77. package/dist/components/cmd_bar/r05_submit_btn.js +64 -72
  78. package/dist/components/cmd_bar/r06_predict_btn.js +142 -152
  79. package/dist/components/cmd_bar/r07_wavelength_btn.js +28 -36
  80. package/dist/components/cmd_bar/tri_btn.js +91 -113
  81. package/dist/components/common/chem.js +2 -3
  82. package/dist/components/common/comps.js +2 -2
  83. package/dist/components/common/draw.js +30 -11
  84. package/dist/components/d3_line/index.js +154 -176
  85. package/dist/components/d3_line/line_focus.js +595 -739
  86. package/dist/components/d3_multi/index.js +153 -174
  87. package/dist/components/d3_multi/multi_focus.js +725 -850
  88. package/dist/components/d3_rect/index.js +112 -134
  89. package/dist/components/d3_rect/rect_focus.js +163 -208
  90. package/dist/components/forecast/comps.js +60 -68
  91. package/dist/components/forecast/ir_comps.js +49 -56
  92. package/dist/components/forecast/ir_viewer.js +61 -68
  93. package/dist/components/forecast/nmr_comps.js +62 -72
  94. package/dist/components/forecast/nmr_viewer.js +59 -68
  95. package/dist/components/forecast/section_loading.js +39 -63
  96. package/dist/components/forecast_viewer.js +109 -119
  97. package/dist/components/multi_jcamps_viewer.js +97 -113
  98. package/dist/components/panel/compare.js +183 -192
  99. package/dist/components/panel/cyclic_voltamery_data.js +149 -165
  100. package/dist/components/panel/graph_selection.js +143 -132
  101. package/dist/components/panel/index.js +112 -144
  102. package/dist/components/panel/info.js +125 -132
  103. package/dist/components/panel/multiplicity.js +215 -223
  104. package/dist/components/panel/multiplicity_coupling.js +108 -136
  105. package/dist/components/panel/multiplicity_select.js +43 -51
  106. package/dist/components/panel/peaks.js +130 -132
  107. package/dist/constants/action_type.js +23 -39
  108. package/dist/constants/list_layout.js +7 -4
  109. package/dist/constants/list_shift.js +117 -103
  110. package/dist/constants/list_ui.js +3 -6
  111. package/dist/constants/list_wavelength.js +7 -8
  112. package/dist/fn.js +2 -3
  113. package/dist/helpers/brush.js +49 -65
  114. package/dist/helpers/calc.js +2 -4
  115. package/dist/helpers/carbonFeatures.js +22 -20
  116. package/dist/helpers/cfg.js +49 -67
  117. package/dist/helpers/chem.js +450 -393
  118. package/dist/helpers/compass.js +92 -83
  119. package/dist/helpers/converter.js +52 -65
  120. package/dist/helpers/extractParams.js +60 -52
  121. package/dist/helpers/extractPeaksEdit.js +29 -25
  122. package/dist/helpers/focus.js +2 -6
  123. package/dist/helpers/format.js +416 -361
  124. package/dist/helpers/init.js +41 -37
  125. package/dist/helpers/integration.js +18 -21
  126. package/dist/helpers/mount.js +57 -61
  127. package/dist/helpers/multiplicity.js +19 -24
  128. package/dist/helpers/multiplicity_calc.js +39 -50
  129. package/dist/helpers/multiplicity_complat.js +21 -47
  130. package/dist/helpers/multiplicity_manual.js +49 -55
  131. package/dist/helpers/multiplicity_verify_basic.js +108 -111
  132. package/dist/helpers/shift.js +15 -23
  133. package/dist/helpers/zoom.js +7 -11
  134. package/dist/index.js +680 -630
  135. package/dist/layer_content.js +40 -43
  136. package/dist/layer_init.js +162 -184
  137. package/dist/layer_prism.js +38 -41
  138. package/dist/reducers/index.js +2 -3
  139. package/dist/reducers/reducer_curve.js +35 -26
  140. package/dist/reducers/reducer_edit_peak.js +122 -98
  141. package/dist/reducers/reducer_forecast.js +57 -44
  142. package/dist/reducers/reducer_integration.js +135 -103
  143. package/dist/reducers/reducer_jcamp.js +49 -44
  144. package/dist/reducers/reducer_layout.js +5 -6
  145. package/dist/reducers/reducer_manager.js +5 -6
  146. package/dist/reducers/reducer_meta.js +5 -6
  147. package/dist/reducers/reducer_multiplicity.js +100 -77
  148. package/dist/reducers/reducer_scan.js +17 -20
  149. package/dist/reducers/reducer_shift.js +115 -70
  150. package/dist/reducers/reducer_simulation.js +7 -8
  151. package/dist/reducers/reducer_status.js +5 -6
  152. package/dist/reducers/reducer_submit.js +12 -15
  153. package/dist/reducers/reducer_threshold.js +5 -6
  154. package/dist/reducers/reducer_ui.js +5 -6
  155. package/dist/reducers/reducer_voltammetry.js +156 -96
  156. package/dist/reducers/reducer_wavelength.js +5 -6
  157. package/dist/reducers/undo_redo_config.js +3 -5
  158. package/dist/sagas/index.js +2 -15
  159. package/dist/sagas/saga_edit_peak.js +54 -68
  160. package/dist/sagas/saga_manager.js +86 -130
  161. package/dist/sagas/saga_meta.js +25 -31
  162. package/dist/sagas/saga_multi_entities.js +40 -103
  163. package/dist/sagas/saga_multiplicity.js +336 -406
  164. package/dist/sagas/saga_ui.js +296 -475
  165. package/dist/setupTests.js +8 -0
  166. package/dist/third_party/jAnalyzer.js +66 -67
  167. package/dist/third_party/peakInterval.js +34 -34
  168. package/package.json +14 -14
  169. package/dist/components/cmd_bar/03_peak_bk.js +0 -139
  170. package/dist/components/cmd_bar/04_integration_bk.js +0 -180
  171. package/dist/components/cmd_bar/05_multiplicity_bk.js +0 -131
  172. package/dist/components/cmd_bar/r01_layout_bk.js +0 -186
  173. package/dist/components/cmd_bar/r06_predict_btn_bk.js +0 -220
  174. package/dist/components/d3_line/line_focus_bk.js +0 -825
  175. package/dist/components/d3_multi/index_bk.js +0 -210
  176. package/dist/components/d3_multi/multi_focus_bk.js +0 -533
  177. package/dist/components/panel/compare_bk.js +0 -256
  178. package/dist/components/panel/cyclic_voltamery_data_bk.js +0 -292
  179. package/dist/components/panel/index_bk.js +0 -178
  180. package/dist/components/panel/info_bk.js +0 -235
  181. package/dist/components/panel/multiplicity_bk.js +0 -280
  182. package/dist/helpers/carbonFeatures_bk.js +0 -45
  183. package/dist/helpers/cfg_bk.js +0 -80
  184. package/dist/helpers/chem_bk.js +0 -787
  185. package/dist/helpers/compass_bk.js +0 -149
  186. package/dist/helpers/converter_bk.js +0 -96
  187. package/dist/helpers/extractPeaksEdit_bk.js +0 -53
  188. package/dist/helpers/format_bk.js +0 -497
  189. package/dist/index_bk.js +0 -640
  190. package/dist/layer_content_bk.js +0 -105
  191. package/dist/layer_init_bk.js +0 -235
  192. package/dist/layer_prism_bk.js +0 -133
  193. package/dist/reducers/reducer_edit_peak_bk.js +0 -108
  194. package/dist/reducers/reducer_integration_bk.js +0 -134
  195. package/dist/reducers/reducer_jcamp_bk.js +0 -71
  196. package/dist/reducers/reducer_multiplicity_bk.js +0 -126
  197. package/dist/reducers/reducer_shift_bk.js +0 -88
  198. package/dist/reducers/reducer_voltammetry_bk.js +0 -287
  199. package/dist/sagas/saga_edit_peak_bk.js +0 -73
  200. package/dist/sagas/saga_multi_entities_bk.js +0 -106
  201. package/dist/sagas/saga_multiplicity_bk.js +0 -351
  202. package/dist/sagas/saga_ui_bk.js +0 -453
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
8
  var d3 = _interopRequireWildcard(require("d3"));
14
9
  var _init = require("../../helpers/init");
15
10
  var _mount = require("../../helpers/mount");
@@ -23,17 +18,19 @@ var _format = _interopRequireDefault(require("../../helpers/format"));
23
18
  var _cfg = _interopRequireDefault(require("../../helpers/cfg"));
24
19
  var _list_layout = require("../../constants/list_layout");
25
20
  var _calc = require("../../helpers/calc");
26
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
23
  /* eslint-disable prefer-object-spread, no-mixed-operators */
29
- var LineFocus = /*#__PURE__*/function () {
30
- function LineFocus(props) {
31
- (0, _classCallCheck2.default)(this, LineFocus);
32
- var W = props.W,
33
- H = props.H,
34
- clickUiTargetAct = props.clickUiTargetAct,
35
- selectUiSweepAct = props.selectUiSweepAct,
36
- scrollUiWheelAct = props.scrollUiWheelAct;
24
+
25
+ class LineFocus {
26
+ constructor(props) {
27
+ const {
28
+ W,
29
+ H,
30
+ clickUiTargetAct,
31
+ selectUiSweepAct,
32
+ scrollUiWheelAct
33
+ } = props;
37
34
  this.jcampIdx = 0;
38
35
  this.rootKlass = '.d3Line';
39
36
  this.margin = {
@@ -92,741 +89,600 @@ var LineFocus = /*#__PURE__*/function () {
92
89
  this.isFirefox = typeof InstallTrigger !== 'undefined';
93
90
  this.wavelength = null;
94
91
  }
95
- (0, _createClass2.default)(LineFocus, [{
96
- key: "getShouldUpdate",
97
- value: function getShouldUpdate(nextEpSt, nextItSt, nextMySt) {
98
- var _this$shouldUpdate = this.shouldUpdate,
99
- prevXt = _this$shouldUpdate.prevXt,
100
- prevYt = _this$shouldUpdate.prevYt,
101
- prevEpSt = _this$shouldUpdate.prevEpSt,
102
- prevLySt = _this$shouldUpdate.prevLySt,
103
- prevItSt = _this$shouldUpdate.prevItSt,
104
- prevMySt = _this$shouldUpdate.prevMySt,
105
- prevTePt = _this$shouldUpdate.prevTePt,
106
- prevDtPk = _this$shouldUpdate.prevDtPk,
107
- prevSfPk = _this$shouldUpdate.prevSfPk,
108
- prevData = _this$shouldUpdate.prevData;
109
- var _TfRescale = (0, _compass.TfRescale)(this),
110
- xt = _TfRescale.xt,
111
- yt = _TfRescale.yt;
112
- var sameXY = xt(1.1) === prevXt && prevYt === yt(1.1);
113
- var sameEpSt = prevEpSt === nextEpSt;
114
- var sameLySt = prevLySt === this.layout;
115
- var sameItSt = prevItSt === nextItSt;
116
- var sameMySt = prevMySt === nextMySt;
117
- var sameTePt = prevTePt === this.tTrEndPts.length;
118
- var sameDtPk = prevDtPk === this.dataPks.length;
119
- var sameSfPk = prevSfPk === this.tSfPeaks.length;
120
- var sameData = prevData === this.data.length;
121
- var sameRef = prevEpSt.prevOffset === nextEpSt.prevOffset;
122
- this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
123
- sameXY: sameXY,
124
- sameEpSt: sameEpSt,
125
- sameLySt: sameLySt,
126
- sameItSt: sameItSt,
127
- sameMySt: sameMySt,
128
- // eslint-disable-line
129
- sameTePt: sameTePt,
130
- sameDtPk: sameDtPk,
131
- sameSfPk: sameSfPk,
132
- sameData: sameData,
133
- sameRef: sameRef // eslint-disable-line
134
- });
135
- }
136
- }, {
137
- key: "resetShouldUpdate",
138
- value: function resetShouldUpdate(prevEpSt, prevItSt, prevMySt) {
139
- var _TfRescale2 = (0, _compass.TfRescale)(this),
140
- xt = _TfRescale2.xt,
141
- yt = _TfRescale2.yt;
142
- var prevXt = xt(1.1);
143
- var prevYt = yt(1.1);
144
- var prevTePt = this.tTrEndPts.length;
145
- var prevDtPk = this.dataPks.length;
146
- var prevSfPk = this.tSfPeaks.length;
147
- var prevData = this.data.length;
148
- var prevLySt = this.layout;
149
- this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
150
- prevXt: prevXt,
151
- prevYt: prevYt,
152
- prevEpSt: prevEpSt,
153
- prevLySt: prevLySt,
154
- prevItSt: prevItSt,
155
- prevMySt: prevMySt,
156
- // eslint-disable-line
157
- prevTePt: prevTePt,
158
- prevDtPk: prevDtPk,
159
- prevSfPk: prevSfPk,
160
- prevData: prevData // eslint-disable-line
161
- });
162
- }
163
- }, {
164
- key: "setTip",
165
- value: function setTip() {
166
- this.tip = (0, _init.InitTip)();
167
- this.root.call(this.tip);
168
- }
169
- }, {
170
- key: "setDataParams",
171
- value: function setDataParams(data, peaks, tTrEndPts, tSfPeaks, freq, layout, wavelength) {
172
- this.data = (0, _toConsumableArray2.default)(data);
173
- this.dataPks = (0, _toConsumableArray2.default)(peaks);
174
- this.tTrEndPts = tTrEndPts;
175
- this.tSfPeaks = tSfPeaks;
176
- this.freq = freq;
177
- this.layout = layout;
178
- this.wavelength = wavelength;
179
- }
180
- }, {
181
- key: "updatePathCall",
182
- value: function updatePathCall(xt, yt) {
183
- this.pathCall = d3.line().x(function (d) {
184
- return xt(d.x);
185
- }).y(function (d) {
186
- return yt(d.y);
187
- });
188
- }
189
- }, {
190
- key: "setConfig",
191
- value: function setConfig(sweepExtentSt) {
192
- // Domain Calculate
193
- var _ref = sweepExtentSt || {
194
- xExtent: false,
195
- yExtent: false
196
- },
197
- xExtent = _ref.xExtent,
198
- yExtent = _ref.yExtent;
199
- if (!xExtent || !yExtent) {
200
- var xes = d3.extent(this.data, function (d) {
201
- return d.x;
202
- }).sort(function (a, b) {
203
- return a - b;
204
- });
205
- xExtent = {
206
- xL: xes[0],
207
- xU: xes[1]
208
- };
209
- var btm = d3.min(this.data, function (d) {
210
- return d.y;
211
- });
212
- var top = d3.max(this.data, function (d) {
213
- return d.y;
214
- });
215
- var height = top - btm;
216
- yExtent = {
217
- yL: btm - this.factor * height,
218
- yU: top + this.factor * height
219
- };
220
- }
221
- this.scales.x.domain([xExtent.xL, xExtent.xU]);
222
- this.scales.y.domain([yExtent.yL, yExtent.yU]);
92
+ getShouldUpdate(nextEpSt, nextItSt, nextMySt) {
93
+ const {
94
+ prevXt,
95
+ prevYt,
96
+ prevEpSt,
97
+ prevLySt,
98
+ prevItSt,
99
+ prevMySt,
100
+ prevTePt,
101
+ prevDtPk,
102
+ prevSfPk,
103
+ prevData
104
+ } = this.shouldUpdate;
105
+ const {
106
+ xt,
107
+ yt
108
+ } = (0, _compass.TfRescale)(this);
109
+ const sameXY = xt(1.1) === prevXt && prevYt === yt(1.1);
110
+ const sameEpSt = prevEpSt === nextEpSt;
111
+ const sameLySt = prevLySt === this.layout;
112
+ const sameItSt = prevItSt === nextItSt;
113
+ const sameMySt = prevMySt === nextMySt;
114
+ const sameTePt = prevTePt === this.tTrEndPts.length;
115
+ const sameDtPk = prevDtPk === this.dataPks.length;
116
+ const sameSfPk = JSON.stringify(prevSfPk) === JSON.stringify(this.tSfPeaks);
117
+ const sameData = prevData === this.data.length;
118
+ const sameRef = prevEpSt.prevOffset === nextEpSt.prevOffset;
119
+ this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
120
+ sameXY,
121
+ sameEpSt,
122
+ sameLySt,
123
+ sameItSt,
124
+ sameMySt,
125
+ // eslint-disable-line
126
+ sameTePt,
127
+ sameDtPk,
128
+ sameSfPk,
129
+ sameData,
130
+ sameRef // eslint-disable-line
131
+ });
132
+ }
223
133
 
224
- // rescale for zoom
225
- var _TfRescale3 = (0, _compass.TfRescale)(this),
226
- xt = _TfRescale3.xt,
227
- yt = _TfRescale3.yt;
134
+ resetShouldUpdate(prevEpSt, prevItSt, prevMySt) {
135
+ const {
136
+ xt,
137
+ yt
138
+ } = (0, _compass.TfRescale)(this);
139
+ const prevXt = xt(1.1);
140
+ const prevYt = yt(1.1);
141
+ const prevTePt = this.tTrEndPts.length;
142
+ const prevDtPk = this.dataPks.length;
143
+ const prevSfPk = this.tSfPeaks;
144
+ const prevData = this.data.length;
145
+ const prevLySt = this.layout;
146
+ this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
147
+ prevXt,
148
+ prevYt,
149
+ prevEpSt,
150
+ prevLySt,
151
+ prevItSt,
152
+ prevMySt,
153
+ // eslint-disable-line
154
+ prevTePt,
155
+ prevDtPk,
156
+ prevSfPk,
157
+ prevData // eslint-disable-line
158
+ });
159
+ }
228
160
 
229
- // Axis Call
230
- this.axisCall.x.scale(xt);
231
- this.axisCall.y.scale(yt);
232
- this.currentExtent = {
233
- xExtent: xExtent,
234
- yExtent: yExtent
161
+ setTip() {
162
+ this.tip = (0, _init.InitTip)();
163
+ this.root.call(this.tip);
164
+ }
165
+ setDataParams(data, peaks, tTrEndPts, tSfPeaks, freq, layout, wavelength) {
166
+ this.data = [...data];
167
+ this.dataPks = [...peaks];
168
+ this.tTrEndPts = tTrEndPts;
169
+ this.tSfPeaks = tSfPeaks;
170
+ this.freq = freq;
171
+ this.layout = layout;
172
+ this.wavelength = wavelength;
173
+ }
174
+ updatePathCall(xt, yt) {
175
+ this.pathCall = d3.line().x(d => xt(d.x)).y(d => yt(d.y));
176
+ }
177
+ setConfig(sweepExtentSt) {
178
+ // Domain Calculate
179
+ let {
180
+ xExtent,
181
+ yExtent
182
+ } = sweepExtentSt || {
183
+ xExtent: false,
184
+ yExtent: false
185
+ };
186
+ if (!xExtent || !yExtent) {
187
+ const xes = d3.extent(this.data, d => d.x).sort((a, b) => a - b);
188
+ xExtent = {
189
+ xL: xes[0],
190
+ xU: xes[1]
235
191
  };
236
- }
237
- }, {
238
- key: "drawLine",
239
- value: function drawLine() {
240
- var _this$shouldUpdate2 = this.shouldUpdate,
241
- sameXY = _this$shouldUpdate2.sameXY,
242
- sameRef = _this$shouldUpdate2.sameRef;
243
- if (sameXY && sameRef) return;
244
- var _TfRescale4 = (0, _compass.TfRescale)(this),
245
- xt = _TfRescale4.xt,
246
- yt = _TfRescale4.yt;
247
- this.updatePathCall(xt, yt);
248
- this.path.attr('d', this.pathCall(this.data));
249
- }
250
- }, {
251
- key: "drawThres",
252
- value: function drawThres() {
253
- if (this.tTrEndPts.length > 0) {
254
- this.thresLineUp.attr('d', this.pathCall(this.tTrEndPts));
255
- this.thresLineUp.attr('visibility', 'visible');
256
- var _this$tTrEndPts = (0, _slicedToArray2.default)(this.tTrEndPts, 2),
257
- left = _this$tTrEndPts[0],
258
- right = _this$tTrEndPts[1];
259
- var dwMirrorEndPts = [Object.assign({}, left, {
260
- y: -left.y
261
- }), Object.assign({}, right, {
262
- y: -right.y
263
- })];
264
- this.thresLineDw.attr('d', this.pathCall(dwMirrorEndPts));
265
- this.thresLineDw.attr('visibility', 'visible');
266
- } else {
267
- this.thresLineUp.attr('visibility', 'hidden');
268
- this.thresLineDw.attr('visibility', 'hidden');
269
- }
270
- }
271
- }, {
272
- key: "drawGrid",
273
- value: function drawGrid() {
274
- var sameXY = this.shouldUpdate.sameXY;
275
- if (sameXY) return;
276
- 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');
277
- 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');
278
- }
279
- }, {
280
- key: "onClickTarget",
281
- value: function onClickTarget(data) {
282
- d3.event.stopPropagation();
283
- d3.event.preventDefault();
284
- var onPeak = true;
285
- this.clickUiTargetAct(data, onPeak);
286
- }
287
- }, {
288
- key: "mergedPeaks",
289
- value: function mergedPeaks(editPeakSt) {
290
- if (!editPeakSt) return this.dataPks;
291
- this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt);
292
- return this.dataPks;
293
- }
294
- }, {
295
- key: "drawAUC",
296
- value: function drawAUC(stack) {
297
- var _this = this;
298
- var _TfRescale5 = (0, _compass.TfRescale)(this),
299
- xt = _TfRescale5.xt,
300
- yt = _TfRescale5.yt;
301
- var auc = this.tags.aucPath.selectAll('path').data(stack);
302
- auc.exit().attr('class', 'exit').remove();
303
- var integCurve = function integCurve(border) {
304
- var xL = border.xL,
305
- xU = border.xU;
306
- var ps = _this.data.filter(function (d) {
307
- return d.x > xL && d.x < xU;
308
- });
309
- if (!ps[0]) return null;
310
- var point1 = ps[0];
311
- var point2 = ps[ps.length - 1];
312
- var slope = (0, _calc.calcSlope)(point1.x, point1.y, point2.x, point2.y);
313
- var lastDY = point1.y;
314
- return d3.area().x(function (d) {
315
- return xt(d.x);
316
- }).y0(function (d, index) {
317
- if (index > 0) {
318
- var lastD = ps[index - 1];
319
- var y = slope * (d.x - lastD.x) + lastDY;
320
- lastDY = y;
321
- return yt(y);
322
- }
323
- return yt(0);
324
- }).y1(function (d) {
325
- return yt(d.y);
326
- })(ps);
192
+ const btm = d3.min(this.data, d => d.y);
193
+ const top = d3.max(this.data, d => d.y);
194
+ const height = top - btm;
195
+ yExtent = {
196
+ yL: btm - this.factor * height,
197
+ yU: top + this.factor * height
327
198
  };
328
- auc.enter().append('path').attr('class', 'auc').attr('fill', 'red').attr('stroke', 'none').attr('fill-opacity', 0.2).attr('stroke-width', 2).merge(auc).attr('d', function (d) {
329
- return integCurve(d);
330
- }).attr('id', function (d) {
331
- return "auc".concat((0, _focus.itgIdTag)(d));
332
- }).on('mouseover', function (d) {
333
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
334
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
335
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).style('fill', 'blue');
336
- }).on('mouseout', function (d) {
337
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'none');
338
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).style('fill', 'red');
339
- d3.select("#auc".concat((0, _focus.itgIdTag)(d))).style('fill-opacity', 0.2);
340
- }).on('click', function (d) {
341
- return _this.onClickTarget(d);
342
- });
343
199
  }
344
- }, {
345
- key: "drawPeaks",
346
- value: function drawPeaks(editPeakSt) {
347
- var _this2 = this;
348
- var _this$shouldUpdate3 = this.shouldUpdate,
349
- sameXY = _this$shouldUpdate3.sameXY,
350
- sameEpSt = _this$shouldUpdate3.sameEpSt,
351
- sameDtPk = _this$shouldUpdate3.sameDtPk,
352
- sameSfPk = _this$shouldUpdate3.sameSfPk;
353
- if (!_format.default.isCyclicVoltaLayout(this.layout) && sameXY && sameEpSt && sameDtPk && sameSfPk) return;
200
+ this.scales.x.domain([xExtent.xL, xExtent.xU]);
201
+ this.scales.y.domain([yExtent.yL, yExtent.yU]);
354
202
 
355
- // rescale for zoom
356
- var _TfRescale6 = (0, _compass.TfRescale)(this),
357
- xt = _TfRescale6.xt,
358
- yt = _TfRescale6.yt;
359
- var dPks = this.mergedPeaks(editPeakSt);
360
- var mpp = this.tags.pPath.selectAll('path').data(dPks);
361
- mpp.exit().attr('class', 'exit').remove();
362
- var linePath = [{
363
- x: -0.5,
364
- y: 10
365
- }, {
366
- x: -0.5,
367
- y: -20
368
- }, {
369
- x: 0.5,
370
- y: -20
371
- }, {
372
- x: 0.5,
373
- y: 10
374
- }];
375
- // const faktor = layoutSt === LIST_LAYOUT.IR ? -1 : 1;
376
- var lineSymbol = d3.line().x(function (d) {
377
- return d.x;
378
- }).y(function (d) {
379
- return d.y;
380
- })(linePath);
381
- 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) {
382
- return "mpp".concat(Math.round(1000 * d.x));
383
- }).attr('transform', function (d) {
384
- return "translate(".concat(xt(d.x), ", ").concat(yt(d.y), ")");
385
- }).on('mouseover', function (d, i, n) {
386
- d3.select("#mpp".concat(Math.round(1000 * d.x))).attr('stroke-opacity', '1.0');
387
- d3.select("#bpt".concat(Math.round(1000 * d.x))).style('fill', 'blue');
388
- var tipParams = {
389
- d: d,
390
- layout: _this2.layout
391
- };
392
- _this2.tip.show(tipParams, n[i]);
393
- }).on('mouseout', function (d, i, n) {
394
- d3.select("#mpp".concat(Math.round(1000 * d.x))).attr('stroke-opacity', '0.0');
395
- d3.select("#bpt".concat(Math.round(1000 * d.x))).style('fill', 'red');
396
- var tipParams = {
397
- d: d,
398
- layout: _this2.layout
399
- };
400
- _this2.tip.hide(tipParams, n[i]);
401
- }).on('click', function (d) {
402
- return _this2.onClickTarget(d);
403
- });
404
- var ignoreRef = _format.default.isHplcUvVisLayout(this.layout);
405
- if (ignoreRef) {
406
- var bpTxt = this.tags.bpTxt.selectAll('text').data(dPks);
407
- bpTxt.exit().attr('class', 'exit').remove();
408
- 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) {
409
- return "mpp".concat(Math.round(1000 * d.x));
410
- }).text(function (d) {
411
- return d.x.toFixed(2);
412
- }).attr('transform', function (d) {
413
- return "translate(".concat(xt(d.x), ", ").concat(yt(d.y) - 25, ")");
414
- }).on('click', function (d) {
415
- return _this2.onClickTarget(d);
416
- });
417
- }
418
- }
419
- }, {
420
- key: "drawInteg",
421
- value: function drawInteg(integationSt) {
422
- var _this3 = this;
423
- var _this$shouldUpdate4 = this.shouldUpdate,
424
- sameXY = _this$shouldUpdate4.sameXY,
425
- sameLySt = _this$shouldUpdate4.sameLySt,
426
- sameItSt = _this$shouldUpdate4.sameItSt,
427
- sameData = _this$shouldUpdate4.sameData;
428
- if (sameXY && sameLySt && sameItSt && sameData) return;
429
- var selectedIdx = integationSt.selectedIdx,
430
- integrations = integationSt.integrations;
431
- var selectedIntegration = integrations[selectedIdx];
432
- var stack = selectedIntegration.stack,
433
- refArea = selectedIntegration.refArea,
434
- refFactor = selectedIntegration.refFactor,
435
- shift = selectedIntegration.shift;
436
- var isDisable = _cfg.default.btnCmdIntg(this.layout);
437
- var ignoreRef = _format.default.isHplcUvVisLayout(this.layout);
438
- var itgs = isDisable ? [] : stack;
439
- var igbp = this.tags.igbPath.selectAll('path').data(itgs);
440
- igbp.exit().attr('class', 'exit').remove();
441
- var igcp = this.tags.igcPath.selectAll('path').data(itgs);
442
- igcp.exit().attr('class', 'exit').remove();
443
- var igtp = this.tags.igtPath.selectAll('text').data(itgs);
444
- igtp.exit().attr('class', 'exit').remove();
445
- if (itgs.length === 0 || isDisable) {
446
- // remove drawn area under curve
447
- var auc = this.tags.aucPath.selectAll('path').data(stack);
448
- auc.exit().attr('class', 'exit').remove();
449
- auc.merge(auc);
450
- return;
451
- }
452
- if (ignoreRef) {
453
- this.drawAUC(stack);
454
- } else {
455
- // rescale for zoom
456
- var _TfRescale7 = (0, _compass.TfRescale)(this),
457
- xt = _TfRescale7.xt;
458
- var dh = 50;
459
- var integBar = function integBar(data) {
460
- return d3.line()([[xt(data.xL - shift), dh], [xt(data.xL - shift), dh - 10], [xt(data.xL - shift), dh - 5], [xt(data.xU - shift), dh - 5], [xt(data.xU - shift), dh - 10], [xt(data.xU - shift), dh]]);
461
- };
462
- igbp.enter().append('path').attr('class', 'igbp').attr('fill', 'none').attr('stroke', '#228B22').attr('stroke-width', 2).merge(igbp).attr('id', function (d) {
463
- return "igbp".concat((0, _focus.itgIdTag)(d));
464
- }).attr('d', function (d) {
465
- return integBar(d);
466
- }).on('mouseover', function (d) {
467
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
468
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
469
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', 'blue');
470
- }).on('mouseout', function (d) {
471
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
472
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
473
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', '#228B22');
474
- }).on('click', function (d) {
475
- return _this3.onClickTarget(d);
476
- });
477
- var integCurve = function integCurve(border) {
478
- var xL = border.xL,
479
- xU = border.xU;
480
- var nXL = xL - shift,
481
- nXU = xU - shift;
482
- var ps = _this3.data.filter(function (d) {
483
- return d.x > nXL && d.x < nXU;
484
- });
485
- var kMax = _this3.data[_this3.data.length - 1].k;
486
- if (!ps[0]) return null;
487
- var kRef = ps[0].k;
488
- if (!_this3.reverseXAxis(_this3.layout)) {
489
- return d3.line().x(function (d) {
490
- return xt(d.x);
491
- }).y(function (d) {
492
- return 100 - (kRef - d.k) * 400 / kMax;
493
- })(ps);
494
- }
495
- return d3.line().x(function (d) {
496
- return xt(d.x);
497
- }).y(function (d) {
498
- return 300 - (d.k - kRef) * 400 / kMax;
499
- })(ps);
500
- };
501
- igcp.enter().append('path').attr('class', 'igcp').attr('fill', 'none').attr('stroke', '#228B22').attr('stroke-width', 2).merge(igcp).attr('id', function (d) {
502
- return "igbc".concat((0, _focus.itgIdTag)(d));
503
- }).attr('d', function (d) {
504
- return integCurve(d);
505
- }).on('mouseover', function (d) {
506
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
507
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
508
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', 'blue');
509
- }).on('mouseout', function (d) {
510
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
511
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
512
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', '#228B22');
513
- }).on('click', function (d) {
514
- return _this3.onClickTarget(d);
515
- });
516
- igtp.enter().append('text').attr('class', 'igtp').attr('font-family', 'Helvetica').style('font-size', '12px').attr('fill', '#228B22').style('text-anchor', 'middle').merge(igtp).attr('id', function (d) {
517
- return "igtp".concat((0, _focus.itgIdTag)(d));
518
- }).text(function (d) {
519
- return (0, _integration.calcArea)(d, refArea, refFactor, ignoreRef);
520
- }).attr('transform', function (d) {
521
- return "translate(".concat(xt((d.xL + d.xU) / 2 - shift), ", ").concat(dh - 12, ")");
522
- }).on('mouseover', function (d) {
523
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
524
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', 'blue');
525
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', 'blue');
526
- }).on('mouseout', function (d) {
527
- d3.select("#igbp".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
528
- d3.select("#igbc".concat((0, _focus.itgIdTag)(d))).attr('stroke', '#228B22');
529
- d3.select("#igtp".concat((0, _focus.itgIdTag)(d))).style('fill', '#228B22');
530
- }).on('click', function (d) {
531
- return _this3.onClickTarget(d);
532
- });
533
- }
203
+ // rescale for zoom
204
+ const {
205
+ xt,
206
+ yt
207
+ } = (0, _compass.TfRescale)(this);
208
+
209
+ // Axis Call
210
+ this.axisCall.x.scale(xt);
211
+ this.axisCall.y.scale(yt);
212
+ this.currentExtent = {
213
+ xExtent,
214
+ yExtent
215
+ };
216
+ }
217
+ drawLine() {
218
+ const {
219
+ sameXY,
220
+ sameRef,
221
+ sameSfPk
222
+ } = this.shouldUpdate;
223
+ if (sameXY && sameRef && sameSfPk) return;
224
+ const {
225
+ xt,
226
+ yt
227
+ } = (0, _compass.TfRescale)(this);
228
+ this.updatePathCall(xt, yt);
229
+ this.path.attr('d', this.pathCall(this.data));
230
+ }
231
+ drawThres() {
232
+ if (this.tTrEndPts.length > 0) {
233
+ this.thresLineUp.attr('d', this.pathCall(this.tTrEndPts));
234
+ this.thresLineUp.attr('visibility', 'visible');
235
+ const [left, right] = this.tTrEndPts;
236
+ const dwMirrorEndPts = [Object.assign({}, left, {
237
+ y: -left.y
238
+ }), Object.assign({}, right, {
239
+ y: -right.y
240
+ })];
241
+ this.thresLineDw.attr('d', this.pathCall(dwMirrorEndPts));
242
+ this.thresLineDw.attr('visibility', 'visible');
243
+ } else {
244
+ this.thresLineUp.attr('visibility', 'hidden');
245
+ this.thresLineDw.attr('visibility', 'hidden');
534
246
  }
535
- }, {
536
- key: "drawMtply",
537
- value: function drawMtply(mtplySt) {
538
- var _ref2,
539
- _this4 = this;
540
- var _this$shouldUpdate5 = this.shouldUpdate,
541
- sameXY = _this$shouldUpdate5.sameXY,
542
- sameLySt = _this$shouldUpdate5.sameLySt,
543
- sameMySt = _this$shouldUpdate5.sameMySt;
544
- if (sameXY && sameLySt && sameMySt) return;
545
- var selectedIdx = mtplySt.selectedIdx,
546
- multiplicities = mtplySt.multiplicities;
547
- var selectedMulti = multiplicities[selectedIdx];
548
- var stack = selectedMulti.stack,
549
- smExtext = selectedMulti.smExtext,
550
- shift = selectedMulti.shift;
551
- var mpys = stack;
552
- var isDisable = _cfg.default.btnCmdMpy(this.layout);
553
- if (mpys === 0 || isDisable) return;
554
- // rescale for zoom
555
- var _TfRescale8 = (0, _compass.TfRescale)(this),
556
- xt = _TfRescale8.xt;
557
- var mpyb = this.tags.mpybPath.selectAll('path').data(mpys);
558
- mpyb.exit().attr('class', 'exit').remove();
559
- var mpyt1 = this.tags.mpyt1Path.selectAll('text').data(mpys);
560
- mpyt1.exit().attr('class', 'exit').remove();
561
- var mpyt2 = this.tags.mpyt2Path.selectAll('text').data(mpys);
562
- mpyt2.exit().attr('class', 'exit').remove();
563
- var mPeaks = mpys.map(function (m) {
564
- var peaks = m.peaks,
565
- xExtent = m.xExtent;
566
- return peaks.map(function (p) {
567
- return Object.assign({}, p, {
568
- xExtent: xExtent
569
- });
570
- });
571
- });
572
- mPeaks = (_ref2 = []).concat.apply(_ref2, (0, _toConsumableArray2.default)(mPeaks));
573
- var mpyp = this.tags.mpypPath.selectAll('path').data(mPeaks);
574
- mpyp.exit().attr('class', 'exit').remove();
575
- var height = this.h;
576
- var dh = Math.abs(0.06 * height);
577
- var mpyBar = function mpyBar(data) {
578
- return d3.line()([[xt(data.xExtent.xL - shift), height - dh], [xt(data.xExtent.xL - shift), height - dh - 10], [xt(data.xExtent.xL - shift), height - dh - 5], [xt(data.xExtent.xU - shift), height - dh - 5], [xt(data.xExtent.xU - shift), height - dh - 10], [xt(data.xExtent.xU - shift), height - dh]]);
579
- };
580
- var mpyColor = function mpyColor(d) {
581
- var _d$xExtent = d.xExtent,
582
- xL = _d$xExtent.xL,
583
- xU = _d$xExtent.xU;
584
- return smExtext.xL === xL && smExtext.xU === xU ? 'purple' : '#DA70D6';
247
+ }
248
+ drawGrid() {
249
+ const {
250
+ sameXY,
251
+ sameSfPk
252
+ } = this.shouldUpdate;
253
+ if (sameXY && sameSfPk) return;
254
+ 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');
255
+ 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');
256
+ }
257
+ onClickTarget(data) {
258
+ d3.event.stopPropagation();
259
+ d3.event.preventDefault();
260
+ const onPeak = true;
261
+ this.clickUiTargetAct(data, onPeak);
262
+ }
263
+ mergedPeaks(editPeakSt) {
264
+ if (!editPeakSt) return this.dataPks;
265
+ this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt);
266
+ return this.dataPks;
267
+ }
268
+ drawAUC(stack) {
269
+ const {
270
+ xt,
271
+ yt
272
+ } = (0, _compass.TfRescale)(this);
273
+ const auc = this.tags.aucPath.selectAll('path').data(stack);
274
+ auc.exit().attr('class', 'exit').remove();
275
+ const integCurve = border => {
276
+ const {
277
+ xL,
278
+ xU
279
+ } = border;
280
+ const ps = this.data.filter(d => d.x > xL && d.x < xU);
281
+ if (!ps[0]) return null;
282
+ const point1 = ps[0];
283
+ const point2 = ps[ps.length - 1];
284
+ const slope = (0, _calc.calcSlope)(point1.x, point1.y, point2.x, point2.y);
285
+ let lastDY = point1.y;
286
+ return d3.area().x(d => xt(d.x)).y0((d, index) => {
287
+ if (index > 0) {
288
+ const lastD = ps[index - 1];
289
+ const y = slope * (d.x - lastD.x) + lastDY;
290
+ lastDY = y;
291
+ return yt(y);
292
+ }
293
+ return yt(0);
294
+ }).y1(d => yt(d.y))(ps);
295
+ };
296
+ auc.enter().append('path').attr('class', 'auc').attr('fill', 'red').attr('stroke', 'none').attr('fill-opacity', 0.2).attr('stroke-width', 2).merge(auc).attr('d', d => integCurve(d)).attr('id', d => `auc${(0, _focus.itgIdTag)(d)}`).on('mouseover', d => {
297
+ d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
298
+ d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
299
+ d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).style('fill', 'blue');
300
+ }).on('mouseout', d => {
301
+ d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'none');
302
+ d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).style('fill', 'red');
303
+ d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).style('fill-opacity', 0.2);
304
+ }).on('click', d => this.onClickTarget(d));
305
+ }
306
+ drawPeaks(editPeakSt) {
307
+ const {
308
+ sameXY,
309
+ sameEpSt,
310
+ sameDtPk,
311
+ sameSfPk
312
+ } = this.shouldUpdate;
313
+ if (!_format.default.isCyclicVoltaLayout(this.layout) && sameXY && sameEpSt && sameDtPk && sameSfPk) return;
314
+
315
+ // rescale for zoom
316
+ const {
317
+ xt,
318
+ yt
319
+ } = (0, _compass.TfRescale)(this);
320
+ const dPks = this.mergedPeaks(editPeakSt);
321
+ const mpp = this.tags.pPath.selectAll('path').data(dPks);
322
+ mpp.exit().attr('class', 'exit').remove();
323
+ const linePath = [{
324
+ x: -0.5,
325
+ y: 10
326
+ }, {
327
+ x: -0.5,
328
+ y: -20
329
+ }, {
330
+ x: 0.5,
331
+ y: -20
332
+ }, {
333
+ x: 0.5,
334
+ y: 10
335
+ }];
336
+ // const faktor = layoutSt === LIST_LAYOUT.IR ? -1 : 1;
337
+ const lineSymbol = d3.line().x(d => d.x).y(d => d.y)(linePath);
338
+ 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', d => `mpp${Math.round(1000 * d.x)}`).attr('transform', d => `translate(${xt(d.x)}, ${yt(d.y)})`).on('mouseover', (d, i, n) => {
339
+ d3.select(`#mpp${Math.round(1000 * d.x)}`).attr('stroke-opacity', '1.0');
340
+ d3.select(`#bpt${Math.round(1000 * d.x)}`).style('fill', 'blue');
341
+ const tipParams = {
342
+ d,
343
+ layout: this.layout
585
344
  };
586
- mpyb.enter().append('path').attr('class', 'mpyb').attr('fill', 'none').attr('stroke-width', 2).merge(mpyb).attr('stroke', function (d) {
587
- return mpyColor(d);
588
- }).attr('id', function (d) {
589
- return "mpyb".concat((0, _focus.mpyIdTag)(d));
590
- }).attr('d', function (d) {
591
- return mpyBar(d);
592
- }).on('mouseover', function (d) {
593
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
594
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
595
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
596
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
597
- }).on('mouseout', function (d) {
598
- var dColor = mpyColor(d);
599
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
600
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
601
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
602
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
603
- }).on('click', function (d) {
604
- return _this4.onClickTarget(d);
605
- });
606
- mpyt1.enter().append('text').attr('class', 'mpyt1').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle').merge(mpyt1).attr('fill', function (d) {
607
- return mpyColor(d);
608
- }).attr('id', function (d) {
609
- return "mpyt1".concat((0, _focus.mpyIdTag)(d));
610
- }).text(function (d) {
611
- return "".concat((0, _multiplicity_calc.calcMpyCenter)(d.peaks, shift, d.mpyType).toFixed(3));
612
- }).attr('transform', function (d) {
613
- return "translate(".concat(xt((d.xExtent.xL + d.xExtent.xU) / 2 - shift), ", ").concat(height - dh + 12, ")");
614
- }).on('mouseover', function (d) {
615
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
616
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
617
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
618
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
619
- }).on('mouseout', function (d) {
620
- var dColor = mpyColor(d);
621
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
622
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
623
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
624
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
625
- }).on('click', function (d) {
626
- return _this4.onClickTarget(d);
627
- });
628
- mpyt2.enter().append('text').attr('class', 'mpyt2').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle').merge(mpyt2).attr('fill', function (d) {
629
- return mpyColor(d);
630
- }).attr('id', function (d) {
631
- return "mpyt2".concat((0, _focus.mpyIdTag)(d));
632
- }).text(function (d) {
633
- return "(".concat(d.mpyType, ")");
634
- }).attr('transform', function (d) {
635
- return "translate(".concat(xt((d.xExtent.xL + d.xExtent.xU) / 2 - shift), ", ").concat(height - dh + 24, ")");
636
- }).on('mouseover', function (d) {
637
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
638
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
639
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
640
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
641
- }).on('mouseout', function (d) {
642
- var dColor = mpyColor(d);
643
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
644
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
645
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
646
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
647
- }).on('click', function (d) {
648
- return _this4.onClickTarget(d);
649
- });
650
- var mpypH = height - dh;
651
- var mpypPath = function mpypPath(pk) {
652
- return [{
653
- x: xt(pk.x - shift) - 0.5,
654
- y: mpypH - 5
655
- }, {
656
- x: xt(pk.x - shift) - 0.5,
657
- y: mpypH - 20
658
- }, {
659
- x: xt(pk.x - shift) + 0.5,
660
- y: mpypH - 20
661
- }, {
662
- x: xt(pk.x - shift) + 0.5,
663
- y: mpypH - 5
664
- }];
345
+ this.tip.show(tipParams, n[i]);
346
+ }).on('mouseout', (d, i, n) => {
347
+ d3.select(`#mpp${Math.round(1000 * d.x)}`).attr('stroke-opacity', '0.0');
348
+ d3.select(`#bpt${Math.round(1000 * d.x)}`).style('fill', 'red');
349
+ const tipParams = {
350
+ d,
351
+ layout: this.layout
665
352
  };
666
- // const faktor = layoutSt === LIST_LAYOUT.IR ? -1 : 1;
667
- var lineSymbol = d3.line().x(function (d) {
668
- return d.x;
669
- }).y(function (d) {
670
- return d.y;
671
- });
672
- mpyp.enter().append('path').attr('class', 'mpyp').attr('fill', 'none').merge(mpyp).attr('stroke', function (d) {
673
- return mpyColor(d);
674
- }).attr('d', function (d) {
675
- return lineSymbol(mpypPath(d));
676
- }).attr('id', function (d) {
677
- return "mpyp".concat((0, _focus.mpyIdTag)(d));
678
- }).on('mouseover', function (d) {
679
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
680
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
681
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', 'blue');
682
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', 'blue');
683
- }).on('mouseout', function (d) {
684
- var dColor = mpyColor(d);
685
- d3.selectAll("#mpyb".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
686
- d3.selectAll("#mpyt1".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
687
- d3.selectAll("#mpyt2".concat((0, _focus.mpyIdTag)(d))).style('fill', dColor);
688
- d3.selectAll("#mpyp".concat((0, _focus.mpyIdTag)(d))).attr('stroke', dColor);
689
- }).on('click', function (d) {
690
- return _this4.onClickTarget(d);
691
- });
353
+ this.tip.hide(tipParams, n[i]);
354
+ }).on('click', d => this.onClickTarget(d));
355
+ const ignoreRef = _format.default.isHplcUvVisLayout(this.layout);
356
+ if (ignoreRef) {
357
+ const bpTxt = this.tags.bpTxt.selectAll('text').data(dPks);
358
+ bpTxt.exit().attr('class', 'exit').remove();
359
+ 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', d => `mpp${Math.round(1000 * d.x)}`).text(d => d.x.toFixed(2)).attr('transform', d => `translate(${xt(d.x)}, ${yt(d.y) - 25})`).on('click', d => this.onClickTarget(d));
692
360
  }
693
- }, {
694
- key: "drawRef",
695
- value: function drawRef() {
696
- // rescale for zoom
697
- var _TfRescale9 = (0, _compass.TfRescale)(this),
698
- xt = _TfRescale9.xt,
699
- yt = _TfRescale9.yt;
700
- var ccp = this.ref.selectAll('path').data(this.tSfPeaks);
701
- ccp.exit().attr('class', 'exit').remove();
702
- var linePath = [{
703
- x: -0.5,
704
- y: 10
705
- }, {
706
- x: -4,
707
- y: -20
708
- }, {
709
- x: 4,
710
- y: -20
711
- }, {
712
- x: 0.5,
713
- y: 10
714
- }];
715
- var faktor = _format.default.isIrLayout(this.layout) ? -1 : 1;
716
- var lineSymbol = d3.line().x(function (d) {
717
- return d.x;
718
- }).y(function (d) {
719
- return faktor * d.y;
720
- })(linePath);
721
- ccp.enter().append('path').attr('d', lineSymbol).attr('class', 'enter-ref').attr('fill', 'green').attr('fill-opacity', 0.8).merge(ccp).attr('transform', function (d) {
722
- return "translate(".concat(xt(d.x), ", ").concat(yt(d.y), ")");
723
- });
724
- }
725
- }, {
726
- key: "drawComparisons",
727
- value: function drawComparisons(comparisons) {
728
- var _this5 = this;
729
- d3.selectAll('.line-clip-compare').remove();
730
- if (!comparisons) return null;
731
- comparisons.forEach(function (c, idx) {
732
- if (!c.show) return;
733
- var path = (0, _mount.MountComparePath)(_this5, _format.default.compareColors(idx), idx); // #D5D8DC
734
- path.attr('d', _this5.pathCall(c.data));
735
- });
736
- return null;
361
+ }
362
+ drawInteg(integationSt) {
363
+ const {
364
+ sameXY,
365
+ sameLySt,
366
+ sameItSt,
367
+ sameData
368
+ } = this.shouldUpdate;
369
+ if (sameXY && sameLySt && sameItSt && sameData) return;
370
+ const {
371
+ selectedIdx,
372
+ integrations
373
+ } = integationSt;
374
+ const selectedIntegration = integrations[selectedIdx];
375
+ const {
376
+ stack,
377
+ refArea,
378
+ refFactor,
379
+ shift
380
+ } = selectedIntegration;
381
+ const isDisable = _cfg.default.btnCmdIntg(this.layout);
382
+ const ignoreRef = _format.default.isHplcUvVisLayout(this.layout);
383
+ const itgs = isDisable ? [] : stack;
384
+ const igbp = this.tags.igbPath.selectAll('path').data(itgs);
385
+ igbp.exit().attr('class', 'exit').remove();
386
+ const igcp = this.tags.igcPath.selectAll('path').data(itgs);
387
+ igcp.exit().attr('class', 'exit').remove();
388
+ const igtp = this.tags.igtPath.selectAll('text').data(itgs);
389
+ igtp.exit().attr('class', 'exit').remove();
390
+ if (itgs.length === 0 || isDisable) {
391
+ // remove drawn area under curve
392
+ const auc = this.tags.aucPath.selectAll('path').data(stack);
393
+ auc.exit().attr('class', 'exit').remove();
394
+ auc.merge(auc);
395
+ return;
737
396
  }
738
- }, {
739
- key: "reverseXAxis",
740
- value: function reverseXAxis(layoutSt) {
741
- return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.SEC].indexOf(layoutSt) < 0;
397
+ if (ignoreRef) {
398
+ this.drawAUC(stack);
399
+ } else {
400
+ // rescale for zoom
401
+ const {
402
+ xt
403
+ } = (0, _compass.TfRescale)(this);
404
+ const dh = 50;
405
+ const integBar = data => d3.line()([[xt(data.xL - shift), dh], [xt(data.xL - shift), dh - 10], [xt(data.xL - shift), dh - 5], [xt(data.xU - shift), dh - 5], [xt(data.xU - shift), dh - 10], [xt(data.xU - shift), dh]]);
406
+ igbp.enter().append('path').attr('class', 'igbp').attr('fill', 'none').attr('stroke', '#228B22').attr('stroke-width', 2).merge(igbp).attr('id', d => `igbp${(0, _focus.itgIdTag)(d)}`).attr('d', d => integBar(d)).on('mouseover', d => {
407
+ d3.select(`#igbp${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
408
+ d3.select(`#igbc${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
409
+ d3.select(`#igtp${(0, _focus.itgIdTag)(d)}`).style('fill', 'blue');
410
+ }).on('mouseout', d => {
411
+ d3.select(`#igbp${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
412
+ d3.select(`#igbc${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
413
+ d3.select(`#igtp${(0, _focus.itgIdTag)(d)}`).style('fill', '#228B22');
414
+ }).on('click', d => this.onClickTarget(d));
415
+ const integCurve = border => {
416
+ const {
417
+ xL,
418
+ xU
419
+ } = border;
420
+ const [nXL, nXU] = [xL - shift, xU - shift];
421
+ const ps = this.data.filter(d => d.x > nXL && d.x < nXU);
422
+ const kMax = this.data[this.data.length - 1].k;
423
+ if (!ps[0]) return null;
424
+ const kRef = ps[0].k;
425
+ if (!this.reverseXAxis(this.layout)) {
426
+ return d3.line().x(d => xt(d.x)).y(d => 100 - (kRef - d.k) * 400 / kMax)(ps);
427
+ }
428
+ return d3.line().x(d => xt(d.x)).y(d => 300 - (d.k - kRef) * 400 / kMax)(ps);
429
+ };
430
+ igcp.enter().append('path').attr('class', 'igcp').attr('fill', 'none').attr('stroke', '#228B22').attr('stroke-width', 2).merge(igcp).attr('id', d => `igbc${(0, _focus.itgIdTag)(d)}`).attr('d', d => integCurve(d)).on('mouseover', d => {
431
+ d3.select(`#igbp${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
432
+ d3.select(`#igbc${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
433
+ d3.select(`#igtp${(0, _focus.itgIdTag)(d)}`).style('fill', 'blue');
434
+ }).on('mouseout', d => {
435
+ d3.select(`#igbp${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
436
+ d3.select(`#igbc${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
437
+ d3.select(`#igtp${(0, _focus.itgIdTag)(d)}`).style('fill', '#228B22');
438
+ }).on('click', d => this.onClickTarget(d));
439
+ igtp.enter().append('text').attr('class', 'igtp').attr('font-family', 'Helvetica').style('font-size', '12px').attr('fill', '#228B22').style('text-anchor', 'middle').merge(igtp).attr('id', d => `igtp${(0, _focus.itgIdTag)(d)}`).text(d => (0, _integration.calcArea)(d, refArea, refFactor, ignoreRef)).attr('transform', d => `translate(${xt((d.xL + d.xU) / 2 - shift)}, ${dh - 12})`).on('mouseover', d => {
440
+ d3.select(`#igbp${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
441
+ d3.select(`#igbc${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
442
+ d3.select(`#igtp${(0, _focus.itgIdTag)(d)}`).style('fill', 'blue');
443
+ }).on('mouseout', d => {
444
+ d3.select(`#igbp${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
445
+ d3.select(`#igbc${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
446
+ d3.select(`#igtp${(0, _focus.itgIdTag)(d)}`).style('fill', '#228B22');
447
+ }).on('click', d => this.onClickTarget(d));
742
448
  }
743
- }, {
744
- key: "create",
745
- value: function create(_ref3) {
746
- var filterSeed = _ref3.filterSeed,
747
- filterPeak = _ref3.filterPeak,
748
- tTrEndPts = _ref3.tTrEndPts,
749
- tSfPeaks = _ref3.tSfPeaks,
750
- freq = _ref3.freq,
751
- comparisons = _ref3.comparisons,
752
- editPeakSt = _ref3.editPeakSt,
753
- layoutSt = _ref3.layoutSt,
754
- integationSt = _ref3.integationSt,
755
- mtplySt = _ref3.mtplySt,
756
- sweepExtentSt = _ref3.sweepExtentSt,
757
- isUiAddIntgSt = _ref3.isUiAddIntgSt,
758
- isUiNoBrushSt = _ref3.isUiNoBrushSt,
759
- wavelength = _ref3.wavelength;
760
- this.svg = d3.select('.d3Svg');
761
- (0, _mount.MountMainFrame)(this, 'focus');
762
- (0, _mount.MountClip)(this);
763
- this.root = d3.select(this.rootKlass).selectAll('.focus-main');
764
- this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
765
- this.setTip();
766
- this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
767
- (0, _compass.MountCompass)(this);
768
- this.axis = (0, _mount.MountAxis)(this);
769
- this.path = (0, _mount.MountPath)(this, 'steelblue');
770
- var _MountThresLine = (0, _mount.MountThresLine)(this, 'green');
771
- var _MountThresLine2 = (0, _slicedToArray2.default)(_MountThresLine, 2);
772
- this.thresLineUp = _MountThresLine2[0];
773
- this.thresLineDw = _MountThresLine2[1];
774
- this.grid = (0, _mount.MountGrid)(this);
775
- this.tags = (0, _mount.MountTags)(this);
776
- this.ref = (0, _mount.MountRef)(this);
777
- (0, _mount.MountAxisLabelX)(this);
778
- (0, _mount.MountAxisLabelY)(this);
779
- if (this.data && this.data.length > 0) {
780
- this.setConfig(sweepExtentSt);
781
- this.drawLine();
782
- this.drawThres();
783
- this.drawGrid();
784
- this.drawRef();
785
- this.drawPeaks(editPeakSt);
786
- this.drawInteg(integationSt);
787
- this.drawMtply(mtplySt);
788
- this.drawComparisons(comparisons);
789
- }
790
- (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
791
- this.resetShouldUpdate(editPeakSt, integationSt, mtplySt);
449
+ }
450
+ drawMtply(mtplySt) {
451
+ const {
452
+ sameXY,
453
+ sameLySt,
454
+ sameMySt
455
+ } = this.shouldUpdate;
456
+ if (sameXY && sameLySt && sameMySt) return;
457
+ const {
458
+ selectedIdx,
459
+ multiplicities
460
+ } = mtplySt;
461
+ const selectedMulti = multiplicities[selectedIdx];
462
+ const {
463
+ stack,
464
+ smExtext,
465
+ shift
466
+ } = selectedMulti;
467
+ const mpys = stack;
468
+ const isDisable = _cfg.default.btnCmdMpy(this.layout);
469
+ if (mpys === 0 || isDisable) return;
470
+ // rescale for zoom
471
+ const {
472
+ xt
473
+ } = (0, _compass.TfRescale)(this);
474
+ const mpyb = this.tags.mpybPath.selectAll('path').data(mpys);
475
+ mpyb.exit().attr('class', 'exit').remove();
476
+ const mpyt1 = this.tags.mpyt1Path.selectAll('text').data(mpys);
477
+ mpyt1.exit().attr('class', 'exit').remove();
478
+ const mpyt2 = this.tags.mpyt2Path.selectAll('text').data(mpys);
479
+ mpyt2.exit().attr('class', 'exit').remove();
480
+ let mPeaks = mpys.map(m => {
481
+ const {
482
+ peaks,
483
+ xExtent
484
+ } = m;
485
+ return peaks.map(p => Object.assign({}, p, {
486
+ xExtent
487
+ }));
488
+ });
489
+ mPeaks = [].concat(...mPeaks);
490
+ const mpyp = this.tags.mpypPath.selectAll('path').data(mPeaks);
491
+ mpyp.exit().attr('class', 'exit').remove();
492
+ const height = this.h;
493
+ const dh = Math.abs(0.06 * height);
494
+ const mpyBar = data => d3.line()([[xt(data.xExtent.xL - shift), height - dh], [xt(data.xExtent.xL - shift), height - dh - 10], [xt(data.xExtent.xL - shift), height - dh - 5], [xt(data.xExtent.xU - shift), height - dh - 5], [xt(data.xExtent.xU - shift), height - dh - 10], [xt(data.xExtent.xU - shift), height - dh]]);
495
+ const mpyColor = d => {
496
+ const {
497
+ xL,
498
+ xU
499
+ } = d.xExtent;
500
+ return smExtext.xL === xL && smExtext.xU === xU ? 'purple' : '#DA70D6';
501
+ };
502
+ mpyb.enter().append('path').attr('class', 'mpyb').attr('fill', 'none').attr('stroke-width', 2).merge(mpyb).attr('stroke', d => mpyColor(d)).attr('id', d => `mpyb${(0, _focus.mpyIdTag)(d)}`).attr('d', d => mpyBar(d)).on('mouseover', d => {
503
+ d3.selectAll(`#mpyb${(0, _focus.mpyIdTag)(d)}`).attr('stroke', 'blue');
504
+ d3.selectAll(`#mpyt1${(0, _focus.mpyIdTag)(d)}`).style('fill', 'blue');
505
+ d3.selectAll(`#mpyt2${(0, _focus.mpyIdTag)(d)}`).style('fill', 'blue');
506
+ d3.selectAll(`#mpyp${(0, _focus.mpyIdTag)(d)}`).attr('stroke', 'blue');
507
+ }).on('mouseout', d => {
508
+ const dColor = mpyColor(d);
509
+ d3.selectAll(`#mpyb${(0, _focus.mpyIdTag)(d)}`).attr('stroke', dColor);
510
+ d3.selectAll(`#mpyt1${(0, _focus.mpyIdTag)(d)}`).style('fill', dColor);
511
+ d3.selectAll(`#mpyt2${(0, _focus.mpyIdTag)(d)}`).style('fill', dColor);
512
+ d3.selectAll(`#mpyp${(0, _focus.mpyIdTag)(d)}`).attr('stroke', dColor);
513
+ }).on('click', d => this.onClickTarget(d));
514
+ mpyt1.enter().append('text').attr('class', 'mpyt1').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle').merge(mpyt1).attr('fill', d => mpyColor(d)).attr('id', d => `mpyt1${(0, _focus.mpyIdTag)(d)}`).text(d => `${(0, _multiplicity_calc.calcMpyCenter)(d.peaks, shift, d.mpyType).toFixed(3)}`).attr('transform', d => `translate(${xt((d.xExtent.xL + d.xExtent.xU) / 2 - shift)}, ${height - dh + 12})`).on('mouseover', d => {
515
+ d3.selectAll(`#mpyb${(0, _focus.mpyIdTag)(d)}`).attr('stroke', 'blue');
516
+ d3.selectAll(`#mpyt1${(0, _focus.mpyIdTag)(d)}`).style('fill', 'blue');
517
+ d3.selectAll(`#mpyt2${(0, _focus.mpyIdTag)(d)}`).style('fill', 'blue');
518
+ d3.selectAll(`#mpyp${(0, _focus.mpyIdTag)(d)}`).attr('stroke', 'blue');
519
+ }).on('mouseout', d => {
520
+ const dColor = mpyColor(d);
521
+ d3.selectAll(`#mpyb${(0, _focus.mpyIdTag)(d)}`).attr('stroke', dColor);
522
+ d3.selectAll(`#mpyt1${(0, _focus.mpyIdTag)(d)}`).style('fill', dColor);
523
+ d3.selectAll(`#mpyt2${(0, _focus.mpyIdTag)(d)}`).style('fill', dColor);
524
+ d3.selectAll(`#mpyp${(0, _focus.mpyIdTag)(d)}`).attr('stroke', dColor);
525
+ }).on('click', d => this.onClickTarget(d));
526
+ mpyt2.enter().append('text').attr('class', 'mpyt2').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle').merge(mpyt2).attr('fill', d => mpyColor(d)).attr('id', d => `mpyt2${(0, _focus.mpyIdTag)(d)}`).text(d => `(${d.mpyType})`).attr('transform', d => `translate(${xt((d.xExtent.xL + d.xExtent.xU) / 2 - shift)}, ${height - dh + 24})`).on('mouseover', d => {
527
+ d3.selectAll(`#mpyb${(0, _focus.mpyIdTag)(d)}`).attr('stroke', 'blue');
528
+ d3.selectAll(`#mpyt1${(0, _focus.mpyIdTag)(d)}`).style('fill', 'blue');
529
+ d3.selectAll(`#mpyt2${(0, _focus.mpyIdTag)(d)}`).style('fill', 'blue');
530
+ d3.selectAll(`#mpyp${(0, _focus.mpyIdTag)(d)}`).attr('stroke', 'blue');
531
+ }).on('mouseout', d => {
532
+ const dColor = mpyColor(d);
533
+ d3.selectAll(`#mpyb${(0, _focus.mpyIdTag)(d)}`).attr('stroke', dColor);
534
+ d3.selectAll(`#mpyt1${(0, _focus.mpyIdTag)(d)}`).style('fill', dColor);
535
+ d3.selectAll(`#mpyt2${(0, _focus.mpyIdTag)(d)}`).style('fill', dColor);
536
+ d3.selectAll(`#mpyp${(0, _focus.mpyIdTag)(d)}`).attr('stroke', dColor);
537
+ }).on('click', d => this.onClickTarget(d));
538
+ const mpypH = height - dh;
539
+ const mpypPath = pk => [{
540
+ x: xt(pk.x - shift) - 0.5,
541
+ y: mpypH - 5
542
+ }, {
543
+ x: xt(pk.x - shift) - 0.5,
544
+ y: mpypH - 20
545
+ }, {
546
+ x: xt(pk.x - shift) + 0.5,
547
+ y: mpypH - 20
548
+ }, {
549
+ x: xt(pk.x - shift) + 0.5,
550
+ y: mpypH - 5
551
+ }];
552
+ // const faktor = layoutSt === LIST_LAYOUT.IR ? -1 : 1;
553
+ const lineSymbol = d3.line().x(d => d.x).y(d => d.y);
554
+ mpyp.enter().append('path').attr('class', 'mpyp').attr('fill', 'none').merge(mpyp).attr('stroke', d => mpyColor(d)).attr('d', d => lineSymbol(mpypPath(d))).attr('id', d => `mpyp${(0, _focus.mpyIdTag)(d)}`).on('mouseover', d => {
555
+ d3.selectAll(`#mpyb${(0, _focus.mpyIdTag)(d)}`).attr('stroke', 'blue');
556
+ d3.selectAll(`#mpyt1${(0, _focus.mpyIdTag)(d)}`).style('fill', 'blue');
557
+ d3.selectAll(`#mpyt2${(0, _focus.mpyIdTag)(d)}`).style('fill', 'blue');
558
+ d3.selectAll(`#mpyp${(0, _focus.mpyIdTag)(d)}`).attr('stroke', 'blue');
559
+ }).on('mouseout', d => {
560
+ const dColor = mpyColor(d);
561
+ d3.selectAll(`#mpyb${(0, _focus.mpyIdTag)(d)}`).attr('stroke', dColor);
562
+ d3.selectAll(`#mpyt1${(0, _focus.mpyIdTag)(d)}`).style('fill', dColor);
563
+ d3.selectAll(`#mpyt2${(0, _focus.mpyIdTag)(d)}`).style('fill', dColor);
564
+ d3.selectAll(`#mpyp${(0, _focus.mpyIdTag)(d)}`).attr('stroke', dColor);
565
+ }).on('click', d => this.onClickTarget(d));
566
+ }
567
+ drawRef() {
568
+ // rescale for zoom
569
+ const {
570
+ xt,
571
+ yt
572
+ } = (0, _compass.TfRescale)(this);
573
+ const ccp = this.ref.selectAll('path').data(this.tSfPeaks);
574
+ ccp.exit().attr('class', 'exit').remove();
575
+ const linePath = [{
576
+ x: -0.5,
577
+ y: 10
578
+ }, {
579
+ x: -4,
580
+ y: -20
581
+ }, {
582
+ x: 4,
583
+ y: -20
584
+ }, {
585
+ x: 0.5,
586
+ y: 10
587
+ }];
588
+ const faktor = _format.default.isIrLayout(this.layout) ? -1 : 1;
589
+ const lineSymbol = d3.line().x(d => d.x).y(d => faktor * d.y)(linePath);
590
+ ccp.enter().append('path').attr('d', lineSymbol).attr('class', 'enter-ref').attr('fill', 'green').attr('fill-opacity', 0.8).merge(ccp).attr('transform', d => `translate(${xt(d.x)}, ${yt(d.y)})`);
591
+ }
592
+ drawComparisons(comparisons) {
593
+ d3.selectAll('.line-clip-compare').remove();
594
+ if (!comparisons) return null;
595
+ comparisons.forEach((c, idx) => {
596
+ if (!c.show) return;
597
+ const path = (0, _mount.MountComparePath)(this, _format.default.compareColors(idx), idx); // #D5D8DC
598
+ path.attr('d', this.pathCall(c.data));
599
+ });
600
+ return null;
601
+ }
602
+ reverseXAxis(layoutSt) {
603
+ return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.DLS_ACF, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.EMISSIONS, _list_layout.LIST_LAYOUT.DLS_INTENSITY].indexOf(layoutSt) < 0;
604
+ }
605
+ create(_ref) {
606
+ let {
607
+ filterSeed,
608
+ filterPeak,
609
+ tTrEndPts,
610
+ tSfPeaks,
611
+ freq,
612
+ comparisons,
613
+ editPeakSt,
614
+ layoutSt,
615
+ integationSt,
616
+ mtplySt,
617
+ sweepExtentSt,
618
+ isUiAddIntgSt,
619
+ isUiNoBrushSt,
620
+ wavelength
621
+ } = _ref;
622
+ this.svg = d3.select('.d3Svg');
623
+ (0, _mount.MountMainFrame)(this, 'focus');
624
+ (0, _mount.MountClip)(this);
625
+ this.root = d3.select(this.rootKlass).selectAll('.focus-main');
626
+ this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
627
+ this.setTip();
628
+ this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
629
+ (0, _compass.MountCompass)(this);
630
+ this.axis = (0, _mount.MountAxis)(this);
631
+ this.path = (0, _mount.MountPath)(this, 'steelblue');
632
+ [this.thresLineUp, this.thresLineDw] = (0, _mount.MountThresLine)(this, 'green');
633
+ this.grid = (0, _mount.MountGrid)(this);
634
+ this.tags = (0, _mount.MountTags)(this);
635
+ this.ref = (0, _mount.MountRef)(this);
636
+ (0, _mount.MountAxisLabelX)(this);
637
+ (0, _mount.MountAxisLabelY)(this);
638
+ if (this.data && this.data.length > 0) {
639
+ this.setConfig(sweepExtentSt);
640
+ this.drawLine();
641
+ this.drawThres();
642
+ this.drawGrid();
643
+ this.drawRef();
644
+ this.drawPeaks(editPeakSt);
645
+ this.drawInteg(integationSt);
646
+ this.drawMtply(mtplySt);
647
+ this.drawComparisons(comparisons);
792
648
  }
793
- }, {
794
- key: "update",
795
- value: function update(_ref4) {
796
- var filterSeed = _ref4.filterSeed,
797
- filterPeak = _ref4.filterPeak,
798
- tTrEndPts = _ref4.tTrEndPts,
799
- tSfPeaks = _ref4.tSfPeaks,
800
- freq = _ref4.freq,
801
- comparisons = _ref4.comparisons,
802
- editPeakSt = _ref4.editPeakSt,
803
- layoutSt = _ref4.layoutSt,
804
- integationSt = _ref4.integationSt,
805
- mtplySt = _ref4.mtplySt,
806
- sweepExtentSt = _ref4.sweepExtentSt,
807
- isUiAddIntgSt = _ref4.isUiAddIntgSt,
808
- isUiNoBrushSt = _ref4.isUiNoBrushSt,
809
- wavelength = _ref4.wavelength;
810
- this.root = d3.select(this.rootKlass).selectAll('.focus-main');
811
- this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
812
- this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
813
- if (this.data && this.data.length > 0) {
814
- this.setConfig(sweepExtentSt);
815
- this.getShouldUpdate(editPeakSt, integationSt, mtplySt);
816
- this.drawLine();
817
- this.drawThres();
818
- this.drawGrid();
819
- this.drawRef();
820
- this.drawPeaks(editPeakSt);
821
- this.drawInteg(integationSt);
822
- this.drawMtply(mtplySt);
823
- this.drawComparisons(comparisons);
824
- }
825
- (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
826
- this.resetShouldUpdate(editPeakSt, integationSt, mtplySt);
649
+ (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
650
+ this.resetShouldUpdate(editPeakSt, integationSt, mtplySt);
651
+ }
652
+ update(_ref2) {
653
+ let {
654
+ filterSeed,
655
+ filterPeak,
656
+ tTrEndPts,
657
+ tSfPeaks,
658
+ freq,
659
+ comparisons,
660
+ editPeakSt,
661
+ layoutSt,
662
+ integationSt,
663
+ mtplySt,
664
+ sweepExtentSt,
665
+ isUiAddIntgSt,
666
+ isUiNoBrushSt,
667
+ wavelength
668
+ } = _ref2;
669
+ this.root = d3.select(this.rootKlass).selectAll('.focus-main');
670
+ this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
671
+ this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
672
+ if (this.data && this.data.length > 0) {
673
+ this.setConfig(sweepExtentSt);
674
+ this.getShouldUpdate(editPeakSt, integationSt, mtplySt);
675
+ this.drawLine();
676
+ this.drawThres();
677
+ this.drawGrid();
678
+ this.drawRef();
679
+ this.drawPeaks(editPeakSt);
680
+ this.drawInteg(integationSt);
681
+ this.drawMtply(mtplySt);
682
+ this.drawComparisons(comparisons);
827
683
  }
828
- }]);
829
- return LineFocus;
830
- }();
831
- var _default = LineFocus;
832
- exports.default = _default;
684
+ (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
685
+ this.resetShouldUpdate(editPeakSt, integationSt, mtplySt);
686
+ }
687
+ }
688
+ var _default = exports.default = LineFocus;