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