hayun-vite 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/styles-test.css +90 -90
- package/assets/styles.css +90 -90
- package/data/formData1.js +42 -42
- package/data/officesObjStore.js +56 -56
- package/data/patientsObjStore.js +73 -73
- package/data/sampleData.js +94 -94
- package/index.js +11 -11
- package/package.json +1 -1
- package/src/Audiogram/Audiogram.js +194 -197
- package/src/Audiogram/dims.js +83 -83
- package/src/Form/Form.js +268 -276
- package/src/Form/Form_N.js +158 -158
- package/src/Form/Forms-Test.html +124 -124
- package/src/Form/Forms.js +121 -134
- package/src/Form/Header.js +91 -91
- package/src/Form/Reflex.js +141 -141
- package/src/Form/Sections.js +71 -71
- package/src/Form/Speech.js +132 -132
- package/src/Form/TextBox.js +66 -80
- package/src/Form/Tympanogram.js +355 -355
- package/src/Form/formStyles.css +122 -122
- package/src/Form/globalinfo.js +68 -68
- package/src/Form/grid/drawGrid.js +84 -84
- package/src/Form/grid/hideGrid.js +8 -8
- package/src/Form/printForm.js +122 -75
- package/src/Form/templates/combo.js +248 -248
- package/src/Form/templates/dims.js +204 -204
- package/src/Form/templates/rasaAud.js +287 -287
- package/src/Symbol/Symbols.js +29 -29
- package/src/Symbol/createSymbolSVG.js +240 -240
- package/src/Symbol/getAllSymbolsSVG.js +21 -21
- package/src/Symbol/insertSymbol.js +10 -10
- package/src/Symbol/symbolChart.js +47 -47
- package/src/common/putLine.js +16 -16
- package/src/common/putPoint.js +12 -12
- package/src/common/putRect.js +13 -13
- package/src/common/putText.js +17 -16
- package/src/common/putTopLayer.js +17 -17
- package/src/main.js +88 -87
- package/src/note.css +62 -0
- package/src/style.css +189 -156
- package/src/note.html +0 -1
@@ -1,240 +1,240 @@
|
|
1
|
-
// ساخت اسویجی شانزده سمبل
|
2
|
-
const svgNS = "http://www.w3.org/2000/svg";
|
3
|
-
export default function createSymbolSVG({ side = "R", type = "AC", masked = false, NR = false }) {
|
4
|
-
let r = 12 / 5; //
|
5
|
-
let
|
6
|
-
dot = [],
|
7
|
-
points = [],
|
8
|
-
dx,
|
9
|
-
xNR,
|
10
|
-
yNR,
|
11
|
-
polyline,
|
12
|
-
circle;
|
13
|
-
|
14
|
-
const svg = document.createElementNS(svgNS, "svg");
|
15
|
-
svg.setAttribute("viewBox", "-6 -6 12 12");
|
16
|
-
|
17
|
-
//افزودن اتریبیوتهای دیتای سمبل
|
18
|
-
svg.setAttribute("data-name", "symbol");
|
19
|
-
svg.setAttribute("data-side", side);
|
20
|
-
svg.setAttribute("data-type", type);
|
21
|
-
svg.setAttribute("data-masked", masked);
|
22
|
-
svg.setAttribute("data-NR", NR);
|
23
|
-
|
24
|
-
|
25
|
-
if (side == "R" && type == "AC" && !masked) {
|
26
|
-
// case "R_AC_NR":
|
27
|
-
dot = [0, 0];
|
28
|
-
//مختصات نقطه اول سمبل عدم پاسخ
|
29
|
-
xNR = r * Math.sin(Math.PI / 4);
|
30
|
-
yNR = xNR;
|
31
|
-
xNR *= -1;
|
32
|
-
|
33
|
-
circle = document.createElementNS(svgNS, "circle");
|
34
|
-
circle.setAttribute("stroke", "red");
|
35
|
-
circle.setAttribute("stroke-width", "0.6px");
|
36
|
-
circle.setAttribute("fill", "transparent");
|
37
|
-
circle.setAttribute("cx", 0);
|
38
|
-
circle.setAttribute("cy", 0);
|
39
|
-
circle.setAttribute("r", r);
|
40
|
-
|
41
|
-
svg.appendChild(circle);
|
42
|
-
}
|
43
|
-
|
44
|
-
if (side == "R" && type == "AC" && masked) {
|
45
|
-
dx = 2 * r * Math.tan(Math.PI / 6);
|
46
|
-
|
47
|
-
points = [0, -r, dx, r, -dx, r, 0, -r];
|
48
|
-
|
49
|
-
polyline = document.createElementNS(svgNS, "polyline");
|
50
|
-
polyline.setAttribute("stroke-width", "0.6px");
|
51
|
-
polyline.setAttribute("stroke-linecap", "round");
|
52
|
-
polyline.setAttribute("stroke-miterlimit", "0");
|
53
|
-
polyline.setAttribute("fill", "transparent");
|
54
|
-
polyline.setAttribute("stroke", "red");
|
55
|
-
polyline.setAttribute("points", points);
|
56
|
-
svg.appendChild(polyline);
|
57
|
-
|
58
|
-
//مختصات نقطه اول سمبل عدم پاسخ
|
59
|
-
xNR = -dx;
|
60
|
-
yNR = r;
|
61
|
-
}
|
62
|
-
|
63
|
-
if (side == "R" && type == "BC" && !masked) {
|
64
|
-
// مقدار جابجایی سمبل از مرکز
|
65
|
-
dx = -r / 1.5;
|
66
|
-
|
67
|
-
//مختصات نقطه اول سمبل عدم پاسخ
|
68
|
-
xNR = dx;
|
69
|
-
yNR = r;
|
70
|
-
|
71
|
-
dot = [0, -r, -r, 0, 0, r];
|
72
|
-
points = [dot[0] + dx, dot[1], dot[2] + dx, dot[3], dot[4] + dx, dot[5]];
|
73
|
-
polyline = document.createElementNS(svgNS, "polyline");
|
74
|
-
polyline.setAttribute("stroke-width", "0.6px");
|
75
|
-
polyline.setAttribute("fill", "transparent");
|
76
|
-
polyline.setAttribute("stroke", "red");
|
77
|
-
polyline.setAttribute("points", points);
|
78
|
-
svg.appendChild(polyline);
|
79
|
-
}
|
80
|
-
|
81
|
-
if (side == "R" && type == "BC" && masked) {
|
82
|
-
// مقدار جابجایی سمبل از مرکز
|
83
|
-
dx = -r / 1.5;
|
84
|
-
|
85
|
-
dot = [0, -r, -r, -r, -r, r, 0, r];
|
86
|
-
|
87
|
-
points = `${dot[0] + dx}, ${dot[1]},
|
88
|
-
${dot[2] + dx}, ${dot[3]},
|
89
|
-
${dot[4] + dx}, ${dot[5]},
|
90
|
-
${dot[6] + dx}, ${dot[7]}
|
91
|
-
`;
|
92
|
-
polyline = document.createElementNS(svgNS, "polyline");
|
93
|
-
polyline.setAttribute("stroke-width", "0.6px");
|
94
|
-
polyline.setAttribute("fill", "transparent");
|
95
|
-
polyline.setAttribute("stroke", "red");
|
96
|
-
polyline.setAttribute("points", points);
|
97
|
-
svg.appendChild(polyline);
|
98
|
-
//مختصات نقطه اول سمبل عدم پاسخ
|
99
|
-
xNR = -r + dx;
|
100
|
-
yNR = r;
|
101
|
-
}
|
102
|
-
|
103
|
-
if (side == "L" && type == "AC" && !masked) {
|
104
|
-
//مختصات نقطه اول سمبل عدم پاسخ
|
105
|
-
xNR = r;
|
106
|
-
yNR = r;
|
107
|
-
|
108
|
-
// const x1 = (Math.sqrt(2) / 2) * r;
|
109
|
-
// const y1 = -x1;
|
110
|
-
// dot = [x1, y1, -x1, -y1, -x1, y1, x1, -y1];
|
111
|
-
|
112
|
-
points = [-r, -r, r, r];
|
113
|
-
|
114
|
-
polyline = document.createElementNS(svgNS, "polyline");
|
115
|
-
polyline.setAttribute("stroke-width", "0.6px");
|
116
|
-
polyline.setAttribute("fill", "transparent");
|
117
|
-
polyline.setAttribute("stroke", "blue");
|
118
|
-
polyline.setAttribute("points", points);
|
119
|
-
svg.appendChild(polyline);
|
120
|
-
|
121
|
-
points = [r, -r, -r, r];
|
122
|
-
polyline = document.createElementNS(svgNS, "polyline");
|
123
|
-
polyline.setAttribute("stroke-width", "0.6px");
|
124
|
-
polyline.setAttribute("fill", "transparent");
|
125
|
-
polyline.setAttribute("stroke", "blue");
|
126
|
-
polyline.setAttribute("points", points);
|
127
|
-
svg.appendChild(polyline);
|
128
|
-
}
|
129
|
-
|
130
|
-
if (side == "L" && type == "AC" && masked) {
|
131
|
-
dot = [0, 0];
|
132
|
-
//مختصات نقطه اول سمبل عدم پاسخ
|
133
|
-
xNR = r;
|
134
|
-
yNR = r;
|
135
|
-
|
136
|
-
// مختصات چهار نقطه مربع سمبل
|
137
|
-
dot = [-r, -r, r, -r, r, r, -r, r, -r, -r];
|
138
|
-
polyline = document.createElementNS(svgNS, "polyline");
|
139
|
-
polyline.setAttribute("stroke-width", "0.6px");
|
140
|
-
polyline.setAttribute("fill", "transparent");
|
141
|
-
polyline.setAttribute("stroke-linecap", "round");
|
142
|
-
polyline.setAttribute("stroke", "blue");
|
143
|
-
polyline.setAttribute("points", dot);
|
144
|
-
svg.appendChild(polyline);
|
145
|
-
}
|
146
|
-
|
147
|
-
if (side == "L" && type == "BC" && !masked) {
|
148
|
-
// مقدار جابجایی سمبل از مرکز
|
149
|
-
dx = r / 1.5;
|
150
|
-
|
151
|
-
//مختصات نقطه اول سمبل عدم پاسخ
|
152
|
-
xNR = dx;
|
153
|
-
yNR = r;
|
154
|
-
|
155
|
-
dot = [0, -r, r, 0, 0, r];
|
156
|
-
points = [dot[0] + dx, dot[1], dot[2] + dx, dot[3], dot[4] + dx, dot[5]];
|
157
|
-
polyline = document.createElementNS(svgNS, "polyline");
|
158
|
-
polyline.setAttribute("stroke-width", "0.6px");
|
159
|
-
polyline.setAttribute("fill", "transparent");
|
160
|
-
polyline.setAttribute("stroke", "blue");
|
161
|
-
polyline.setAttribute("points", points);
|
162
|
-
svg.appendChild(polyline);
|
163
|
-
}
|
164
|
-
|
165
|
-
if (side == "L" && type == "BC" && masked) {
|
166
|
-
// مقدار جابجایی سمبل از مرکز
|
167
|
-
dx = r / 1.5;
|
168
|
-
|
169
|
-
//مختصات نقطه اول سمبل عدم پاسخ
|
170
|
-
xNR = r + dx;
|
171
|
-
yNR = r;
|
172
|
-
|
173
|
-
dot = [0, -r, r, -r, r, r, 0, r];
|
174
|
-
points = `${dot[0] + dx}, ${dot[1]},
|
175
|
-
${dot[2] + dx}, ${dot[3]},
|
176
|
-
${dot[4] + dx}, ${dot[5]},
|
177
|
-
${dot[6] + dx}, ${dot[7]}
|
178
|
-
`;
|
179
|
-
polyline = document.createElementNS(svgNS, "polyline");
|
180
|
-
polyline.setAttribute("stroke-width", "0.6px");
|
181
|
-
polyline.setAttribute("fill", "transparent");
|
182
|
-
polyline.setAttribute("stroke", "blue");
|
183
|
-
polyline.setAttribute("points", points);
|
184
|
-
svg.appendChild(polyline);
|
185
|
-
}
|
186
|
-
|
187
|
-
|
188
|
-
//رسم قسمت NR
|
189
|
-
if (NR) {
|
190
|
-
svg.appendChild(createNRSVG(side, xNR, yNR));
|
191
|
-
// تابع ایجاد تصویر عدم پاسخ
|
192
|
-
function createNRSVG(side, x, y) {
|
193
|
-
let symColor = side === "R" ? "red" : "blue";
|
194
|
-
let angle = side === "R" ? "135" : "45";
|
195
|
-
const a = r / 2;
|
196
|
-
const x1 = a * Math.cos(Math.PI / 6);
|
197
|
-
const y1 = a * Math.sin(Math.PI / 6);
|
198
|
-
// مختصات سه نقطه فلش
|
199
|
-
//A, B, C
|
200
|
-
let points = [-x1 + r + x, -y1 + y, r + x, y, -x1 + x + r, y1 + y];
|
201
|
-
const g = document.createElementNS(svgNS, "g");
|
202
|
-
let polyline = document.createElementNS(svgNS, "polyline");
|
203
|
-
polyline.setAttribute("stroke-width", "0.4px");
|
204
|
-
polyline.setAttribute("fill", "transparent");
|
205
|
-
polyline.setAttribute("stroke", symColor);
|
206
|
-
polyline.setAttribute("points", points);
|
207
|
-
g.appendChild(polyline);
|
208
|
-
// مختصات خط فلش
|
209
|
-
points = [x, y, x + r, y];
|
210
|
-
polyline = document.createElementNS(svgNS, "polyline");
|
211
|
-
polyline.setAttribute("stroke-width", "0.4px");
|
212
|
-
polyline.setAttribute("fill", "transparent");
|
213
|
-
polyline.setAttribute("stroke", symColor);
|
214
|
-
polyline.setAttribute("points", points);
|
215
|
-
g.setAttribute("transform", `rotate(${angle} ${x} ${y})`);
|
216
|
-
g.appendChild(polyline);
|
217
|
-
return g;
|
218
|
-
}
|
219
|
-
}
|
220
|
-
// این رویی ترین اسویجی برای اینکه تارگت کلیک روی محدوده سمبل رو بتونیم پیدا کنیم
|
221
|
-
// یک بوردر برای اس وی جی به تمام پهنا و ارتفاع رسم میکنیم
|
222
|
-
const rect = document.createElementNS(svgNS, "rect");
|
223
|
-
rect.setAttribute("x", -6);
|
224
|
-
rect.setAttribute("y", -6);
|
225
|
-
rect.setAttribute("width", 12);
|
226
|
-
rect.setAttribute("height", 12);
|
227
|
-
rect.setAttribute("fill", "transparent");
|
228
|
-
//
|
229
|
-
//
|
230
|
-
//
|
231
|
-
// با حذف پایینی برای یافتن سمبل ها در دام به مشکل خواهیم خورد و باید راه حل جدید براش ایجاد کنیم
|
232
|
-
let symbolName = side + "_" + type;
|
233
|
-
if (masked) symbolName += "_M";
|
234
|
-
if (NR) symbolName += "_NR";
|
235
|
-
rect.setAttribute("data-name", symbolName);
|
236
|
-
// rect.setAttribute("stroke-width", "0.5px");
|
237
|
-
// rect.setAttribute("stroke", "green");
|
238
|
-
svg.appendChild(rect);
|
239
|
-
return svg;
|
240
|
-
}
|
1
|
+
// ساخت اسویجی شانزده سمبل
|
2
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
3
|
+
export default function createSymbolSVG({ side = "R", type = "AC", masked = false, NR = false }) {
|
4
|
+
let r = 12 / 5; //
|
5
|
+
let
|
6
|
+
dot = [],
|
7
|
+
points = [],
|
8
|
+
dx,
|
9
|
+
xNR,
|
10
|
+
yNR,
|
11
|
+
polyline,
|
12
|
+
circle;
|
13
|
+
|
14
|
+
const svg = document.createElementNS(svgNS, "svg");
|
15
|
+
svg.setAttribute("viewBox", "-6 -6 12 12");
|
16
|
+
|
17
|
+
//افزودن اتریبیوتهای دیتای سمبل
|
18
|
+
svg.setAttribute("data-name", "symbol");
|
19
|
+
svg.setAttribute("data-side", side);
|
20
|
+
svg.setAttribute("data-type", type);
|
21
|
+
svg.setAttribute("data-masked", masked);
|
22
|
+
svg.setAttribute("data-NR", NR);
|
23
|
+
|
24
|
+
|
25
|
+
if (side == "R" && type == "AC" && !masked) {
|
26
|
+
// case "R_AC_NR":
|
27
|
+
dot = [0, 0];
|
28
|
+
//مختصات نقطه اول سمبل عدم پاسخ
|
29
|
+
xNR = r * Math.sin(Math.PI / 4);
|
30
|
+
yNR = xNR;
|
31
|
+
xNR *= -1;
|
32
|
+
|
33
|
+
circle = document.createElementNS(svgNS, "circle");
|
34
|
+
circle.setAttribute("stroke", "red");
|
35
|
+
circle.setAttribute("stroke-width", "0.6px");
|
36
|
+
circle.setAttribute("fill", "transparent");
|
37
|
+
circle.setAttribute("cx", 0);
|
38
|
+
circle.setAttribute("cy", 0);
|
39
|
+
circle.setAttribute("r", r);
|
40
|
+
|
41
|
+
svg.appendChild(circle);
|
42
|
+
}
|
43
|
+
|
44
|
+
if (side == "R" && type == "AC" && masked) {
|
45
|
+
dx = 2 * r * Math.tan(Math.PI / 6);
|
46
|
+
|
47
|
+
points = [0, -r, dx, r, -dx, r, 0, -r];
|
48
|
+
|
49
|
+
polyline = document.createElementNS(svgNS, "polyline");
|
50
|
+
polyline.setAttribute("stroke-width", "0.6px");
|
51
|
+
polyline.setAttribute("stroke-linecap", "round");
|
52
|
+
polyline.setAttribute("stroke-miterlimit", "0");
|
53
|
+
polyline.setAttribute("fill", "transparent");
|
54
|
+
polyline.setAttribute("stroke", "red");
|
55
|
+
polyline.setAttribute("points", points);
|
56
|
+
svg.appendChild(polyline);
|
57
|
+
|
58
|
+
//مختصات نقطه اول سمبل عدم پاسخ
|
59
|
+
xNR = -dx;
|
60
|
+
yNR = r;
|
61
|
+
}
|
62
|
+
|
63
|
+
if (side == "R" && type == "BC" && !masked) {
|
64
|
+
// مقدار جابجایی سمبل از مرکز
|
65
|
+
dx = -r / 1.5;
|
66
|
+
|
67
|
+
//مختصات نقطه اول سمبل عدم پاسخ
|
68
|
+
xNR = dx;
|
69
|
+
yNR = r;
|
70
|
+
|
71
|
+
dot = [0, -r, -r, 0, 0, r];
|
72
|
+
points = [dot[0] + dx, dot[1], dot[2] + dx, dot[3], dot[4] + dx, dot[5]];
|
73
|
+
polyline = document.createElementNS(svgNS, "polyline");
|
74
|
+
polyline.setAttribute("stroke-width", "0.6px");
|
75
|
+
polyline.setAttribute("fill", "transparent");
|
76
|
+
polyline.setAttribute("stroke", "red");
|
77
|
+
polyline.setAttribute("points", points);
|
78
|
+
svg.appendChild(polyline);
|
79
|
+
}
|
80
|
+
|
81
|
+
if (side == "R" && type == "BC" && masked) {
|
82
|
+
// مقدار جابجایی سمبل از مرکز
|
83
|
+
dx = -r / 1.5;
|
84
|
+
|
85
|
+
dot = [0, -r, -r, -r, -r, r, 0, r];
|
86
|
+
|
87
|
+
points = `${dot[0] + dx}, ${dot[1]},
|
88
|
+
${dot[2] + dx}, ${dot[3]},
|
89
|
+
${dot[4] + dx}, ${dot[5]},
|
90
|
+
${dot[6] + dx}, ${dot[7]}
|
91
|
+
`;
|
92
|
+
polyline = document.createElementNS(svgNS, "polyline");
|
93
|
+
polyline.setAttribute("stroke-width", "0.6px");
|
94
|
+
polyline.setAttribute("fill", "transparent");
|
95
|
+
polyline.setAttribute("stroke", "red");
|
96
|
+
polyline.setAttribute("points", points);
|
97
|
+
svg.appendChild(polyline);
|
98
|
+
//مختصات نقطه اول سمبل عدم پاسخ
|
99
|
+
xNR = -r + dx;
|
100
|
+
yNR = r;
|
101
|
+
}
|
102
|
+
|
103
|
+
if (side == "L" && type == "AC" && !masked) {
|
104
|
+
//مختصات نقطه اول سمبل عدم پاسخ
|
105
|
+
xNR = r;
|
106
|
+
yNR = r;
|
107
|
+
|
108
|
+
// const x1 = (Math.sqrt(2) / 2) * r;
|
109
|
+
// const y1 = -x1;
|
110
|
+
// dot = [x1, y1, -x1, -y1, -x1, y1, x1, -y1];
|
111
|
+
|
112
|
+
points = [-r, -r, r, r];
|
113
|
+
|
114
|
+
polyline = document.createElementNS(svgNS, "polyline");
|
115
|
+
polyline.setAttribute("stroke-width", "0.6px");
|
116
|
+
polyline.setAttribute("fill", "transparent");
|
117
|
+
polyline.setAttribute("stroke", "blue");
|
118
|
+
polyline.setAttribute("points", points);
|
119
|
+
svg.appendChild(polyline);
|
120
|
+
|
121
|
+
points = [r, -r, -r, r];
|
122
|
+
polyline = document.createElementNS(svgNS, "polyline");
|
123
|
+
polyline.setAttribute("stroke-width", "0.6px");
|
124
|
+
polyline.setAttribute("fill", "transparent");
|
125
|
+
polyline.setAttribute("stroke", "blue");
|
126
|
+
polyline.setAttribute("points", points);
|
127
|
+
svg.appendChild(polyline);
|
128
|
+
}
|
129
|
+
|
130
|
+
if (side == "L" && type == "AC" && masked) {
|
131
|
+
dot = [0, 0];
|
132
|
+
//مختصات نقطه اول سمبل عدم پاسخ
|
133
|
+
xNR = r;
|
134
|
+
yNR = r;
|
135
|
+
|
136
|
+
// مختصات چهار نقطه مربع سمبل
|
137
|
+
dot = [-r, -r, r, -r, r, r, -r, r, -r, -r];
|
138
|
+
polyline = document.createElementNS(svgNS, "polyline");
|
139
|
+
polyline.setAttribute("stroke-width", "0.6px");
|
140
|
+
polyline.setAttribute("fill", "transparent");
|
141
|
+
polyline.setAttribute("stroke-linecap", "round");
|
142
|
+
polyline.setAttribute("stroke", "blue");
|
143
|
+
polyline.setAttribute("points", dot);
|
144
|
+
svg.appendChild(polyline);
|
145
|
+
}
|
146
|
+
|
147
|
+
if (side == "L" && type == "BC" && !masked) {
|
148
|
+
// مقدار جابجایی سمبل از مرکز
|
149
|
+
dx = r / 1.5;
|
150
|
+
|
151
|
+
//مختصات نقطه اول سمبل عدم پاسخ
|
152
|
+
xNR = dx;
|
153
|
+
yNR = r;
|
154
|
+
|
155
|
+
dot = [0, -r, r, 0, 0, r];
|
156
|
+
points = [dot[0] + dx, dot[1], dot[2] + dx, dot[3], dot[4] + dx, dot[5]];
|
157
|
+
polyline = document.createElementNS(svgNS, "polyline");
|
158
|
+
polyline.setAttribute("stroke-width", "0.6px");
|
159
|
+
polyline.setAttribute("fill", "transparent");
|
160
|
+
polyline.setAttribute("stroke", "blue");
|
161
|
+
polyline.setAttribute("points", points);
|
162
|
+
svg.appendChild(polyline);
|
163
|
+
}
|
164
|
+
|
165
|
+
if (side == "L" && type == "BC" && masked) {
|
166
|
+
// مقدار جابجایی سمبل از مرکز
|
167
|
+
dx = r / 1.5;
|
168
|
+
|
169
|
+
//مختصات نقطه اول سمبل عدم پاسخ
|
170
|
+
xNR = r + dx;
|
171
|
+
yNR = r;
|
172
|
+
|
173
|
+
dot = [0, -r, r, -r, r, r, 0, r];
|
174
|
+
points = `${dot[0] + dx}, ${dot[1]},
|
175
|
+
${dot[2] + dx}, ${dot[3]},
|
176
|
+
${dot[4] + dx}, ${dot[5]},
|
177
|
+
${dot[6] + dx}, ${dot[7]}
|
178
|
+
`;
|
179
|
+
polyline = document.createElementNS(svgNS, "polyline");
|
180
|
+
polyline.setAttribute("stroke-width", "0.6px");
|
181
|
+
polyline.setAttribute("fill", "transparent");
|
182
|
+
polyline.setAttribute("stroke", "blue");
|
183
|
+
polyline.setAttribute("points", points);
|
184
|
+
svg.appendChild(polyline);
|
185
|
+
}
|
186
|
+
|
187
|
+
|
188
|
+
//رسم قسمت NR
|
189
|
+
if (NR) {
|
190
|
+
svg.appendChild(createNRSVG(side, xNR, yNR));
|
191
|
+
// تابع ایجاد تصویر عدم پاسخ
|
192
|
+
function createNRSVG(side, x, y) {
|
193
|
+
let symColor = side === "R" ? "red" : "blue";
|
194
|
+
let angle = side === "R" ? "135" : "45";
|
195
|
+
const a = r / 2;
|
196
|
+
const x1 = a * Math.cos(Math.PI / 6);
|
197
|
+
const y1 = a * Math.sin(Math.PI / 6);
|
198
|
+
// مختصات سه نقطه فلش
|
199
|
+
//A, B, C
|
200
|
+
let points = [-x1 + r + x, -y1 + y, r + x, y, -x1 + x + r, y1 + y];
|
201
|
+
const g = document.createElementNS(svgNS, "g");
|
202
|
+
let polyline = document.createElementNS(svgNS, "polyline");
|
203
|
+
polyline.setAttribute("stroke-width", "0.4px");
|
204
|
+
polyline.setAttribute("fill", "transparent");
|
205
|
+
polyline.setAttribute("stroke", symColor);
|
206
|
+
polyline.setAttribute("points", points);
|
207
|
+
g.appendChild(polyline);
|
208
|
+
// مختصات خط فلش
|
209
|
+
points = [x, y, x + r, y];
|
210
|
+
polyline = document.createElementNS(svgNS, "polyline");
|
211
|
+
polyline.setAttribute("stroke-width", "0.4px");
|
212
|
+
polyline.setAttribute("fill", "transparent");
|
213
|
+
polyline.setAttribute("stroke", symColor);
|
214
|
+
polyline.setAttribute("points", points);
|
215
|
+
g.setAttribute("transform", `rotate(${angle} ${x} ${y})`);
|
216
|
+
g.appendChild(polyline);
|
217
|
+
return g;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
// این رویی ترین اسویجی برای اینکه تارگت کلیک روی محدوده سمبل رو بتونیم پیدا کنیم
|
221
|
+
// یک بوردر برای اس وی جی به تمام پهنا و ارتفاع رسم میکنیم
|
222
|
+
const rect = document.createElementNS(svgNS, "rect");
|
223
|
+
rect.setAttribute("x", -6);
|
224
|
+
rect.setAttribute("y", -6);
|
225
|
+
rect.setAttribute("width", 12);
|
226
|
+
rect.setAttribute("height", 12);
|
227
|
+
rect.setAttribute("fill", "transparent");
|
228
|
+
//
|
229
|
+
//
|
230
|
+
//
|
231
|
+
// با حذف پایینی برای یافتن سمبل ها در دام به مشکل خواهیم خورد و باید راه حل جدید براش ایجاد کنیم
|
232
|
+
let symbolName = side + "_" + type;
|
233
|
+
if (masked) symbolName += "_M";
|
234
|
+
if (NR) symbolName += "_NR";
|
235
|
+
rect.setAttribute("data-name", symbolName);
|
236
|
+
// rect.setAttribute("stroke-width", "0.5px");
|
237
|
+
// rect.setAttribute("stroke", "green");
|
238
|
+
svg.appendChild(rect);
|
239
|
+
return svg;
|
240
|
+
}
|
@@ -1,22 +1,22 @@
|
|
1
|
-
import createSymbolSVG from "./createSymbolSVG.js"
|
2
|
-
export default function getAllSymbolsSVG() {
|
3
|
-
return {
|
4
|
-
R_AC: createSymbolSVG({ side: "R", type: "AC" }),
|
5
|
-
R_AC_NR: createSymbolSVG({ side: "R", type: "AC", NR: true }),
|
6
|
-
R_AC_M: createSymbolSVG({ side: "R", type: "AC", masked: true }),
|
7
|
-
R_AC_M_NR: createSymbolSVG({ side: "R", type: "AC", masked: true, NR: true }),
|
8
|
-
R_BC: createSymbolSVG({ side: "R", type: "BC" }),
|
9
|
-
R_BC_NR: createSymbolSVG({ side: "R", type: "BC", NR: true }),
|
10
|
-
R_BC_M: createSymbolSVG({ side: "R", type: "BC", masked: true }),
|
11
|
-
R_BC_M_NR: createSymbolSVG({ side: "R", type: "BC", masked: true, NR: true }),
|
12
|
-
L_AC: createSymbolSVG({ side: "L", type: "AC" }),
|
13
|
-
L_AC_NR: createSymbolSVG({ side: "L", type: "AC", NR: true }),
|
14
|
-
L_AC_M: createSymbolSVG({ side: "L", type: "AC", masked: true }),
|
15
|
-
L_AC_M_NR: createSymbolSVG({ side: "L", type: "AC", masked: true, NR: true }),
|
16
|
-
L_BC: createSymbolSVG({ side: "L", type: "BC" }),
|
17
|
-
L_BC_NR: createSymbolSVG({ side: "L", type: "BC", NR: true }),
|
18
|
-
L_BC_M: createSymbolSVG({ side: "L", type: "BC", masked: true }),
|
19
|
-
L_BC_M_NR: createSymbolSVG({ side: "L", type: "BC", masked: true, NR: true }),
|
20
|
-
|
21
|
-
}
|
1
|
+
import createSymbolSVG from "./createSymbolSVG.js"
|
2
|
+
export default function getAllSymbolsSVG() {
|
3
|
+
return {
|
4
|
+
R_AC: createSymbolSVG({ side: "R", type: "AC" }),
|
5
|
+
R_AC_NR: createSymbolSVG({ side: "R", type: "AC", NR: true }),
|
6
|
+
R_AC_M: createSymbolSVG({ side: "R", type: "AC", masked: true }),
|
7
|
+
R_AC_M_NR: createSymbolSVG({ side: "R", type: "AC", masked: true, NR: true }),
|
8
|
+
R_BC: createSymbolSVG({ side: "R", type: "BC" }),
|
9
|
+
R_BC_NR: createSymbolSVG({ side: "R", type: "BC", NR: true }),
|
10
|
+
R_BC_M: createSymbolSVG({ side: "R", type: "BC", masked: true }),
|
11
|
+
R_BC_M_NR: createSymbolSVG({ side: "R", type: "BC", masked: true, NR: true }),
|
12
|
+
L_AC: createSymbolSVG({ side: "L", type: "AC" }),
|
13
|
+
L_AC_NR: createSymbolSVG({ side: "L", type: "AC", NR: true }),
|
14
|
+
L_AC_M: createSymbolSVG({ side: "L", type: "AC", masked: true }),
|
15
|
+
L_AC_M_NR: createSymbolSVG({ side: "L", type: "AC", masked: true, NR: true }),
|
16
|
+
L_BC: createSymbolSVG({ side: "L", type: "BC" }),
|
17
|
+
L_BC_NR: createSymbolSVG({ side: "L", type: "BC", NR: true }),
|
18
|
+
L_BC_M: createSymbolSVG({ side: "L", type: "BC", masked: true }),
|
19
|
+
L_BC_M_NR: createSymbolSVG({ side: "L", type: "BC", masked: true, NR: true }),
|
20
|
+
|
21
|
+
}
|
22
22
|
}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
// تابع قرار دادن سمبل انتخاب شده در نقطه مورد نظر
|
2
|
-
export default function insertSymbol({ container, symbolNode, x, y, w, h, freq, intens }) {
|
3
|
-
symbolNode.setAttribute("x", x - w / 2);
|
4
|
-
symbolNode.setAttribute("y", y - h / 2);
|
5
|
-
symbolNode.setAttribute("width", w);
|
6
|
-
symbolNode.setAttribute("height", h);
|
7
|
-
symbolNode.setAttribute("data-freq", freq);
|
8
|
-
symbolNode.setAttribute("data-intens", intens);
|
9
|
-
container.appendChild(symbolNode);
|
10
|
-
}
|
1
|
+
// تابع قرار دادن سمبل انتخاب شده در نقطه مورد نظر
|
2
|
+
export default function insertSymbol({ container, symbolNode, x, y, w, h, freq, intens }) {
|
3
|
+
symbolNode.setAttribute("x", x - w / 2);
|
4
|
+
symbolNode.setAttribute("y", y - h / 2);
|
5
|
+
symbolNode.setAttribute("width", w);
|
6
|
+
symbolNode.setAttribute("height", h);
|
7
|
+
symbolNode.setAttribute("data-freq", freq);
|
8
|
+
symbolNode.setAttribute("data-intens", intens);
|
9
|
+
container.appendChild(symbolNode);
|
10
|
+
}
|
@@ -1,47 +1,47 @@
|
|
1
|
-
// وارد کردن دادههای سراسری
|
2
|
-
// import { r, svgNS } from "../../globalinfo.js";
|
3
|
-
import insertSymbol from "./insertSymbol.js";
|
4
|
-
// رسم پنل سمبل ها
|
5
|
-
const svgNS = "http://www.w3.org/2000/svg";
|
6
|
-
|
7
|
-
export default function symbolChart({ container, side = "R", x, y, symbols }) {
|
8
|
-
|
9
|
-
const w = 240;
|
10
|
-
const h = 60;
|
11
|
-
const svg = document.createElementNS(svgNS, "svg");
|
12
|
-
// svg.setAttribute("id", id);
|
13
|
-
svg.setAttribute("width", w);
|
14
|
-
svg.setAttribute("height", h);
|
15
|
-
svg.setAttribute("viewBox", "-6 -6 48 12");
|
16
|
-
svg.setAttribute("style", "border: 1px solid blue; user-select: none;");
|
17
|
-
|
18
|
-
let dx = 12
|
19
|
-
x = 0;
|
20
|
-
y = 0;
|
21
|
-
|
22
|
-
const symbolNames = {
|
23
|
-
R: ["R_AC", "R_BC", "R_AC_M", "R_BC_M"],
|
24
|
-
L: ["L_AC", "L_BC", "L_AC_M", "L_BC_M"]
|
25
|
-
};
|
26
|
-
const metadata = side + "SymbolChart";
|
27
|
-
// اجرای تابع رسم سمبل در چارت در یک حلقه تکرار
|
28
|
-
for (let i = 0; i < 4; i++) {
|
29
|
-
const id = `${symbolNames[side][i]}-SymbolChart`;
|
30
|
-
|
31
|
-
insertSymbol({ container: svg, symbolNode: symbols[symbolNames[side][i]], x: x, y: y, w: 12, h: 12 })
|
32
|
-
// insertSymbol({
|
33
|
-
// container: svg, metadata: metadata,
|
34
|
-
// dataID: id, id: id, class: symbolNames[side][i], symbol: symbolNames[side][i],
|
35
|
-
// x: x, y: y, w: 12, h: 12
|
36
|
-
// });
|
37
|
-
x += dx;
|
38
|
-
}
|
39
|
-
|
40
|
-
container.appendChild(svg);
|
41
|
-
|
42
|
-
return svg;
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
1
|
+
// وارد کردن دادههای سراسری
|
2
|
+
// import { r, svgNS } from "../../globalinfo.js";
|
3
|
+
import insertSymbol from "./insertSymbol.js";
|
4
|
+
// رسم پنل سمبل ها
|
5
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
6
|
+
|
7
|
+
export default function symbolChart({ container, side = "R", x, y, symbols }) {
|
8
|
+
|
9
|
+
const w = 240;
|
10
|
+
const h = 60;
|
11
|
+
const svg = document.createElementNS(svgNS, "svg");
|
12
|
+
// svg.setAttribute("id", id);
|
13
|
+
svg.setAttribute("width", w);
|
14
|
+
svg.setAttribute("height", h);
|
15
|
+
svg.setAttribute("viewBox", "-6 -6 48 12");
|
16
|
+
svg.setAttribute("style", "border: 1px solid blue; user-select: none;");
|
17
|
+
|
18
|
+
let dx = 12
|
19
|
+
x = 0;
|
20
|
+
y = 0;
|
21
|
+
|
22
|
+
const symbolNames = {
|
23
|
+
R: ["R_AC", "R_BC", "R_AC_M", "R_BC_M"],
|
24
|
+
L: ["L_AC", "L_BC", "L_AC_M", "L_BC_M"]
|
25
|
+
};
|
26
|
+
const metadata = side + "SymbolChart";
|
27
|
+
// اجرای تابع رسم سمبل در چارت در یک حلقه تکرار
|
28
|
+
for (let i = 0; i < 4; i++) {
|
29
|
+
const id = `${symbolNames[side][i]}-SymbolChart`;
|
30
|
+
|
31
|
+
insertSymbol({ container: svg, symbolNode: symbols[symbolNames[side][i]], x: x, y: y, w: 12, h: 12 })
|
32
|
+
// insertSymbol({
|
33
|
+
// container: svg, metadata: metadata,
|
34
|
+
// dataID: id, id: id, class: symbolNames[side][i], symbol: symbolNames[side][i],
|
35
|
+
// x: x, y: y, w: 12, h: 12
|
36
|
+
// });
|
37
|
+
x += dx;
|
38
|
+
}
|
39
|
+
|
40
|
+
container.appendChild(svg);
|
41
|
+
|
42
|
+
return svg;
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|