hayun-vite 0.11.2 → 0.13.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.
@@ -4,6 +4,7 @@ const template_combo = {
4
4
  // backgroundImage: 'backgroundImage',
5
5
  // تعیین نمایش بوردرهای سکشن ها
6
6
  sectionBorders: 'display', // display || none
7
+ boxBorders: 'none', // display || none
7
8
  margin: { left: 5, top: 5, right: 5, bottom: 5 },
8
9
  paper: { type: 'A4', case: 'portrait', width: 210, height: 297 },
9
10
 
@@ -36,6 +37,7 @@ const template_combo = {
36
37
  w: width, h: 8,
37
38
  margin: { left: 1, top: 0, right: 1, bottom: 0 },
38
39
  display: 'block',
40
+ boxBorder: 'none' // display || none default: none
39
41
  }
40
42
 
41
43
  this.history = {
@@ -43,6 +45,7 @@ const template_combo = {
43
45
  w: width, h: 14,
44
46
  margin: { left: 1, top: 0, right: 1, bottom: 0 },
45
47
  display: 'block',
48
+ boxBorder: 'none' // display || none
46
49
  }
47
50
 
48
51
  // Titles Common Object
@@ -92,7 +95,7 @@ const template_combo = {
92
95
  this.RSpeech = {
93
96
  name: 'RSpeech',
94
97
  w: width / 2, h: 15,
95
- margin: { left: 1, top: 0, right: 2, bottom: 0 },
98
+ margin: { left: 1, top: 0, right: 10, bottom: 0 },
96
99
  display: 'inline',
97
100
  stroke: true,
98
101
  }
@@ -100,7 +103,7 @@ const template_combo = {
100
103
  this.LSpeech = {
101
104
  name: 'LSpeech',
102
105
  w: width / 2, h: 15,
103
- margin: { left: 2, top: 0, right: 1, bottom: 0 },
106
+ margin: { left: 10, top: 0, right: 1, bottom: 0 },
104
107
  display: 'block',
105
108
  stroke: true
106
109
  }
@@ -116,14 +119,14 @@ const template_combo = {
116
119
  this.RTympanogram = {
117
120
  name: 'RTympanogram',
118
121
  w: width / 2, h: 60,
119
- margin: { left: 1, top: 0, right: 2, bottom: 0 },
122
+ margin: { left: 1, top: 0, right: 10, bottom: 0 },
120
123
  display: 'inline',
121
124
  }
122
125
 
123
126
  this.LTympanogram = {
124
127
  name: 'LTympanogram',
125
128
  w: width / 2, h: 60,
126
- margin: { left: 2, top: 0, right: 1, bottom: 0 },
129
+ margin: { left: 10, top: 0, right: 1, bottom: 0 },
127
130
  display: 'block',
128
131
  }
129
132
 
@@ -138,14 +141,14 @@ const template_combo = {
138
141
  this.RReflex = {
139
142
  name: 'RReflex',
140
143
  w: width / 2, h: 26,
141
- margin: { left: 1, top: 0, right: 2, bottom: 1 },
144
+ margin: { left: 1, top: 0, right: 10, bottom: 1 },
142
145
  display: 'inline'
143
146
  }
144
147
 
145
148
  this.LReflex = {
146
149
  name: 'LReflex',
147
150
  w: width / 2, h: 26,
148
- margin: { left: 2, top: 0, right: 1, bottom: 1 },
151
+ margin: { left: 10, top: 0, right: 1, bottom: 1 },
149
152
  display: 'block'
150
153
  }
151
154
 
package/index.html CHANGED
@@ -3,11 +3,14 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <link rel="icon" type="image/svg+xml" href="vite.svg" />
6
+ <link rel="stylesheet" href="/src/styles.css">
6
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
+
7
9
  <title>hayun</title>
8
10
  </head>
9
11
  <body>
10
12
  <div id="app"></div>
11
- <script type="module" src="/src/main.js"></script>
13
+ <!-- <script type="module" src="/src/main.js"></script> -->
14
+ <script type="module" src="/src/Tympanogram/test.js"></script>
12
15
  </body>
13
16
  </html>
package/index.js CHANGED
@@ -3,6 +3,8 @@ import dims from './src/Audiogram/dims'
3
3
  import { officeData, patientData } from './assets/data/sampleData'
4
4
  import Forms from './src/Forms/Forms'
5
5
  import combo_template from './assets/templates/template_combo'
6
+ import './src/styles.css'
7
+
6
8
  // import rasa_aud_template from './assets/templates/rasa_audiometry'
7
9
  // import rasa_tymp_reflex_template from './assets/templates/rasa_tymp_reflex'
8
10
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hayun-vite",
3
3
  "private": false,
4
- "version": "0.11.2",
4
+ "version": "0.13.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
package/src/Form/Form.js CHANGED
@@ -14,13 +14,13 @@ export default class Form {
14
14
  this.container = container;
15
15
  this.data = {};
16
16
  let { width, height, margin, paper } = template;
17
- this.form = this.create({ paper, margin });
18
- this.form.style.display = 'none';
17
+ this.page = this.create({ paper, margin });
18
+ this.page.style.display = 'none';
19
19
  let dims;
20
20
  // رسم مارجین های فرم
21
- this.drawMarginLines({ container: this.form, width, height });
21
+ this.drawMarginLines({ container: this.page, width, height });
22
22
 
23
- const sections = new Sections({ container: this.form, dims: template });
23
+ const sections = new Sections({ container: this.page, dims: template });
24
24
  this.sections = sections;
25
25
 
26
26
  if (sections.header) {
@@ -101,7 +101,7 @@ export default class Form {
101
101
  this.footer = new MultiText({ container: sections.footer, dims})
102
102
  }
103
103
 
104
- this.container.appendChild(this.form);
104
+ this.container.appendChild(this.page);
105
105
  }
106
106
 
107
107
 
@@ -46,7 +46,7 @@ export default class Sections {
46
46
  putRect({
47
47
  container: svg, x: 0, y: 0, width, height,
48
48
  style: 'fill: transparent; stroke: blue; stroke-width: 0.2',
49
- className: 'no-print', name: 'guide-border'
49
+ className: 'no-print', name: 'section-border'
50
50
  });
51
51
 
52
52
  this[name] = svg;
@@ -46,7 +46,7 @@ export default class Sections {
46
46
  putRect({
47
47
  container: svg, x: 0, y: 0, width, height,
48
48
  style: 'fill: transparent; stroke: blue; stroke-width: 0.2',
49
- className: 'no-print', name: 'guide-border'
49
+ className: 'no-print', name: 'section-border'
50
50
  });
51
51
 
52
52
  this[name] = svg;
@@ -1,14 +1,16 @@
1
- const svgNS = "http://www.w3.org/2000/svg";
2
-
1
+ // import '../styles.css' // برای تست منتقل شد به فایل ایندکس اصلی اچ‌تی‌ام‌ال و برای توسعه منتقل شده به ایندکس جی اس
2
+ import putLine from "../common/putLine.js";
3
3
  import printForm from "./printForm.js";
4
4
  import Form from "../Form/Form.js";
5
+
6
+ const svgNS = "http://www.w3.org/2000/svg";
7
+
5
8
  // import combo from "./templates/combo.js"; // این در حقیقیت یک تمپلت هست
6
9
  // import rasaAud from "./templates/rasa_audiometry.js";
7
10
  // import rasaTymp from './templates/rasa_tymp_reflex.js'
8
11
 
9
12
  // خط کد زیر لازم هست
10
13
  // import '/fonts/webfonts/Vazirmatn-Regular.woff2'
11
- import '../styles.css'
12
14
 
13
15
  // کلاس جدید که فرم‌های مختلف را نمایش میدهد
14
16
  export default class Forms {
@@ -22,9 +24,9 @@ export default class Forms {
22
24
  // افزودن فرم
23
25
  addForms({ templates, defaultTemplateIndex }) {
24
26
  const container = this.container
25
-
26
27
  // ایجاد یک دیو برای قرار دادن دکمه ها و لینک های فرم
27
28
  const div = document.createElement('div');
29
+
28
30
  div.style = 'border: 1px solid brown; margin: 0; padding: 0;'
29
31
  container.appendChild(div);
30
32
 
@@ -34,17 +36,17 @@ export default class Forms {
34
36
 
35
37
  const forms = []; // آرایه آبجکت های فرم های مختلف
36
38
  this.forms = forms;
37
- this.pages = forms
38
39
 
39
- templates.forEach((template, index) => {
40
- (this.mode == 'develop') &&
41
- (btns[index] = this.putButton({ container: div, text: template.label, className }));
42
- this.forms.push(new Form({ container, template }));
43
- });
40
+ templates.
41
+ forEach((template, index) => {
42
+ this.mode == 'develop' &&
43
+ (btns[index] = this.putButton({ container: div, text: template.label, className }));
44
+ this.forms.push(new Form({ container, template }));
45
+ });
44
46
 
45
47
  // انتخاب فرم پیش‌فرض
46
48
  let selectedIndex = defaultTemplateIndex;
47
- forms[selectedIndex].form.style.display = 'block';
49
+ forms[selectedIndex].page.style.display = 'block';
48
50
  this.selectedForm = this.forms[selectedIndex];
49
51
  (this.mode == 'develop') && (btns[selectedIndex].style.backgroundColor = ' #1c15e1');
50
52
 
@@ -52,18 +54,18 @@ export default class Forms {
52
54
 
53
55
  const printBtn = this.putButton({ container: div, text: 'چاپ', className });
54
56
  // تعریف رویداد دکمه چاپ فرم نمایشی
55
- printBtn.addEventListener('click', () => { printForm({ container: this.selectedForm.form }) });
57
+ printBtn.addEventListener('click', () => { printForm({ container: this.selectedForm.page }) });
56
58
 
57
59
  btns.forEach((btn, index) => {
58
60
  btn.addEventListener('click', () => {
59
61
  // Hide All forms
60
62
  forms.forEach((form, i) => {
61
- form.form.style.display = 'none'
63
+ form.page.style.display = 'none'
62
64
  btns[i].style.backgroundColor = ' #7472e2'
63
65
 
64
66
  });
65
67
 
66
- forms[index].form.style.display = 'block';
68
+ forms[index].page.style.display = 'block';
67
69
  btns[index].style.backgroundColor = ' #1c15e1'
68
70
 
69
71
  this.selectedForm = forms[index];
@@ -72,12 +74,55 @@ export default class Forms {
72
74
  })
73
75
  })
74
76
 
75
- this.putButton({ container: div, text: 'Show/Hide', className })
76
- .addEventListener('click', () => { this.toggleDisplay({ container: forms[selectedIndex].form }) });
77
+ // دکمه نمایش و پنهان خطوط سکشن
78
+ this.putButton({ container: div, text: 'Show/Hide Section Borders', className })
79
+ .addEventListener('click', () => {
80
+ this.toggleDisplay({ container: forms[selectedIndex].page, borderName: 'section-border' })
81
+ });
82
+
83
+ // دکمه نمایش و پنهان خطوط بوردر
84
+ this.putButton({ container: div, text: 'Show/Hide Box Borders', className })
85
+ .addEventListener('click', () => {
86
+ this.toggleDisplay({ container: forms[selectedIndex].page, borderName: 'box-border' })
87
+ });
88
+
89
+ // دکمه نمایش و پنهان شطرنجی
90
+ this.putButton({ container: div, text: 'Show/Hide Grid', className })
91
+ .addEventListener('mouseenter', () => {
92
+ this.grid({ container: forms[selectedIndex].page })
93
+ });
94
+ // فراخوانی تابع شطرنجی در اولین اجرا
95
+ this.grid({ container: forms[selectedIndex].page })
77
96
  }
78
97
  }
79
98
 
99
+ grid({ container }) {
100
+ console.log(container);
101
+ const cord = { xStart: -5, yStart: -5, xEnd: 210 - 5, yEnd: 297 - 5, xStep: 1, yStep: 1 }
102
+ let { xStart, yStart, xEnd, yEnd, xStep, yStep } = cord
103
+
104
+ // رسم خطوط افقی
105
+ let style = 'stroke: blue; stroke-width: 0.05 ; stroke-opacity: 0.8; stroke-dasharray: 0.2;'
106
+ let x1 = xStart
107
+ let y1
80
108
 
109
+ let x2 = xEnd
110
+ let y2
111
+
112
+ for (let y1 = yStart; y1 <= yEnd; y1 += yStep) {
113
+ y2 = y1
114
+ putLine({ container, x1, y1, x2, y2, style, name: 'grid' })
115
+ }
116
+
117
+ // رسم خطوط عمودی
118
+ y1 = yStart
119
+ for (x1 = xStart; x1 <= xEnd; x1 += xStep) {
120
+ const x2 = x1
121
+ putLine({ container, x1, y1, x2, y2, style, name: 'grid' })
122
+ }
123
+
124
+
125
+ }
81
126
 
82
127
  // این تابع یک بار از بیرون کلاس فراخوانی میشه و یک بار وقتی از داخل تمپلت فرم را عوض میکنیم
83
128
  update({ data, officeData, patientData, sessionIndex = 0 }) {
@@ -97,8 +142,8 @@ export default class Forms {
97
142
  }
98
143
 
99
144
  // تابع تاگل نمایش و مخفی کردن خطوط راهنمای طراحی
100
- toggleDisplay({ container }) {
101
- container.querySelectorAll(`[data-name='guide-border']`)
145
+ toggleDisplay({ container, borderName }) {
146
+ container.querySelectorAll(`[data-name=${borderName}]`)
102
147
  .forEach(element => {
103
148
  element.style.display = (element.style.display === '') ? 'none' : '';
104
149
  });
@@ -62,11 +62,23 @@ export default class MultiText {
62
62
  const borderRect = putRect({
63
63
  container: svg, x: 0, y: 0, width, height,
64
64
  name: dims.name, className: 'no-print',
65
- style: 'stroke: green; fill: transparent; stroke-width: 0.3;'
65
+ style: 'stroke: transparent; fill: transparent; stroke-width: 0.3;'
66
66
  });
67
-
68
67
  this.borderRect = borderRect;
69
68
  this.container.appendChild(svg)
69
+
70
+ // Box Border for Design guid with Brown Color
71
+ dims.boxBorder === 'display' && putRect({
72
+ container: svg, x: 0, y: 0, width, height,
73
+ style: 'fill: transparent; stroke-width: 0.3; stroke: brown;',
74
+ name: 'box-border',
75
+ className: 'no-print',
76
+ })
77
+
78
+ this.container.appendChild(svg)
79
+
80
+
81
+
70
82
  }
71
83
 
72
84
  update(data) {
@@ -1,14 +1,13 @@
1
1
  import putRect from "../common/putRect.js";
2
2
  import putSVG from "../common/putSVG.js";
3
3
  import putText from "../common/putText.js";
4
- import putCell from "../common/putCell.js";
5
4
  import units from "./units.js";
6
5
 
7
6
  export default class Reflex {
8
7
  constructor({ container, side, dims }) {
9
8
  this.container = container;
10
9
  this.side = side; // این برای تعیین رنگ راست و چپ استفاده می‌شود
11
- this.draw({dims})
10
+ this.draw({ dims })
12
11
  }
13
12
 
14
13
  draw({ dims }) {
@@ -22,54 +21,35 @@ export default class Reflex {
22
21
  // کل چارت
23
22
  // const svg = putSVG({ x, y, width, height, className: 'reflex' })
24
23
  let { styles, vbWidth, vbHeight } = units;
25
-
24
+
26
25
  // کل چارت
26
+ style = styles.svg
27
27
  vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
28
28
  const viewBox = [0, 0, vbWidth, vbHeight].join(' ');
29
- const svg = putSVG({ x, y, width, height, viewBox })
29
+ const svg = putSVG({ x, y, width, height, viewBox, style })
30
30
  // این خط شد دو خط کد طلایی که مشکل سایز فونت در دیسپلی و کاغذ رو حل کرد
31
31
  width = vbWidth; // ثابت می‌ماند همیشه
32
32
  height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
33
33
 
34
34
 
35
-
35
+ // چاپ برچسب‌های سطر اول
36
+ style = styles.numberlabel;
36
37
  let lable = ["", "500", "1000", "2000", "4000"]; // مقادیر برچسب‌های سطر اول
37
38
  // جدولی با ۳ سطر و ۵ ستون
38
39
  let cw1 = width / 5; // پهنای خانه‌های سطر اول
39
40
  let ch1 = height / 3; // ارتفاع خانه‌های سطر اول
40
41
  let ch2 = height / 3; // ارتفاع خانه‌های سطر دوم
41
42
 
42
- // چاپ برچسب‌های سطر اول
43
- style = `
44
- user-select: none;
45
- direction: ltr !important;
46
- /* text-align: center; */
47
- font-family: Arial, Helvetica, sans-serif !important;
48
- font-size: 1mm;
49
- font-weight: bold;
50
- text-anchor: middle; /*تراز افقی*/
51
- dominant-baseline: middle; /* تراز عمودی*/
52
- `;
53
43
  lable.forEach((value, i) => {
54
44
  if (value != "") {
55
45
  let x = cw1 / 2 + cw1 * i;
56
46
  let y = ch1 / 2;
57
- // putText(value, x, y, "", "middle", "middle"); // با استایل تراز عمودی پایین نسبت به خط پایه
58
47
  putText({ container: svg, value, x, y, style })
59
48
  }
60
49
  });
61
50
 
62
51
  // مقادیر برچسب‌های ستون اول
63
- style = `
64
- user-select: none;
65
- direction: ltr !important;
66
- /* text-align: center; */
67
- font-family: Arial, Helvetica, sans-serif !important;
68
- font-size: 1mm;
69
- font-weight: bold;
70
- text-anchor: end; /*تراز افقی*/
71
- dominant-baseline: middle; /* تراز عمودی*/
72
- `;
52
+ style = styles.textLable
73
53
  lable = ["Freq", "IPSI", "CONTRA"];
74
54
  // چاپ برچسب‌های ستون اول
75
55
  putText({ container: svg, value: "Freq", x: cw1, y: ch1 / 2, style: style })
@@ -77,24 +57,27 @@ export default class Reflex {
77
57
  putText({ container: svg, value: "CONTRA", x: cw1, y: ch1 * 5 / 2, style: style })
78
58
 
79
59
  //چاپ ده باکس سطر دوم و سوم
60
+ const inputBox = {
61
+ width: width / 5 * 0.80, height: height / 3 * 0.8,
62
+ rx: width / 100
63
+ }
64
+ // محاسبه کمان گردی بر اساس مقدار پهنا
65
+ inputBox.rx = inputBox.width / 10
66
+
80
67
  for (let j = 1; j <= 2; j++) {
81
68
  for (let i = 1; i <= 4; i++) {
82
- let x = cw1 / 2 + cw1 * i;
83
- let y = ch1 * j + ch2 / 2;
69
+ let cx = cw1 / 2 + cw1 * i;
70
+ let cy = ch1 * j + ch2 / 2;
84
71
  //رسم باکس با مختصات مرکز باکس
85
- putCell({ container: svg, x, y, dx: 0, dy: -1, width: 13, height: 7, rx: 1 });
72
+ putRect({
73
+ container: svg, cx, cy,
74
+ width: inputBox.width, height: inputBox.height, rx: inputBox.rx
75
+ });
86
76
  }
87
77
  }
88
78
 
89
- style = `
90
- user-select: none;
91
- direction: ltr !important;
92
- /* text-align: center; */
93
- font-family: Arial, Helvetica, sans-serif !important;
94
- font-size: 1mm;
95
- text-anchor: middle; /*تراز افقی*/
96
- dominant-baseline: middle; /* تراز عمودی*/
97
- `;
79
+ // مقادیر ورودی عددی
80
+ style = styles.inputNumber
98
81
  // اضافه کردن رنگ قرمز یا آبی به استایل بر اساس جهت
99
82
  style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
100
83
 
@@ -102,7 +85,7 @@ export default class Reflex {
102
85
  for (let index = 0; index < 4; index++) {
103
86
  x = cw1 / 2 + cw1 * (index + 1);
104
87
  y = ch1 + ch2 / 2;
105
- putText({ container: svg, value: "", x, y, dx: 0, dy: -1, style, name: names[index] })
88
+ putText({ container: svg, value: "", x, y, style, name: names[index] })
106
89
  }
107
90
 
108
91
  // المنت‌های تکست خالی با آیدی یکتا در سطر سوم
@@ -113,7 +96,7 @@ export default class Reflex {
113
96
  // const idValue = idValues[index];
114
97
  x = cw1 / 2 + cw1 * (index + 1);
115
98
  y = ch1 * 2 + ch2 / 2;
116
- putText({ container: svg, value: "", x, y, dx: 0, dy: -1, style, name: names[index] })
99
+ putText({ container: svg, value: "", x, y, style, name: names[index] })
117
100
  }
118
101
  // مربع احاطه‌کننده کل جدول برای راهنمای توسعه و دریافت رویداد کلیک روی فرم
119
102
  style = 'fill: transparent; stroke: green; stroke-width: 0.5;';
@@ -12,53 +12,25 @@ const units = {
12
12
  height: 30,
13
13
 
14
14
  styles: {
15
- pressure: `
16
- user-select: none;
17
- direction: ltr !important;
18
- font-family: Vazir;
19
- font-size: 3;
20
- text-anchor: middle;
21
- dominant-baseline: hanging;
22
- `,
23
- caption: `
24
- user-select: none;
25
- direction: ltr !important;
26
- font-family: Vazir;
27
- font-size: 3;
28
- text-anchor: middle;
15
+ svg: 'user-select: none; direction: ltr !important; font-family: Vazir;',
16
+ textLable: `
17
+ font-size: 4.2;
18
+ font-weight: bold;
19
+ text-anchor: end;
29
20
  dominant-baseline: middle;
30
21
  `,
31
- label: `
32
- user-select: none;
33
- direction: ltr !important;
34
- font-family: Vazir;
35
- font-size: 1mm;
36
- text-anchor: start;
37
- dominant-baseline: middle;
38
- `,
39
- type: `
40
- user-select: none;
41
- direction: ltr !important;
42
- font-family: Vazir;
43
- font-size: 1mm;
44
- font-weight: bold;
45
- text-anchor: start;
22
+ numberlabel: `
23
+ font-size: 4.2;
24
+ font-weight: 700;
25
+ text-anchor: middle;
46
26
  dominant-baseline: middle;
47
27
  `,
48
- compliance: `
49
- user-select: none;
50
- direction: ltr !important;
51
- font-family: Vazir;
52
- font-size: 0.7mm;
53
- text-anchor: end;
54
- dominant-baseline: middle;
28
+ inputNumber: `
29
+ font-size: 4.2;
30
+ font-weight: 700;
31
+ text-anchor: middle;
32
+ dominant-baseline: middle;
55
33
  `,
56
- mainFreqline: `stroke: black; stroke-width: 1;`,
57
- semiOctavFreqline: `stroke: black; stroke-width: 1; stroke-dasharray: 4;`,
58
- boldLine: 'stroke: black; stroke-width: 3;',
59
-
60
- juncDashLine: `stroke-width: 1 ; stroke-opacity: 0.8; stroke-dasharray: 4;`,
61
- juncLine: `stroke-width: 1; stroke-opacity: 0.8;`,
62
34
  },
63
35
  }
64
36
 
@@ -1,4 +1,4 @@
1
- import putCell from "../common/putCell.js";
1
+ // https://docs.google.com/document/d/19Pgsi0eHRDgsxjkbxweHLRKVB60jrH4fzV52I83-6CM/edit?tab=t.977lyzmcu5uu#heading=h.sd8yc08kbsfo
2
2
  import putRect from "../common/putRect.js";
3
3
  import putText from "../common/putText.js";
4
4
  import putSVG from "../common/putSVG.js";
@@ -9,11 +9,10 @@ export default class Speech {
9
9
  constructor({ container, side = 'R', dims }) {
10
10
  this.container = container;
11
11
  this.side = side;
12
- this.draw({dims})
12
+ this.draw({ dims })
13
13
  }
14
14
 
15
15
  draw({ dims }) {
16
- // console.log(dims);
17
16
 
18
17
  // دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
19
18
  this.inputs = (dims.forceInsert) ? dims.forceInputs : dims.inputs
@@ -23,6 +22,7 @@ export default class Speech {
23
22
  let x = dims.margin.left;
24
23
  let y = dims.margin.top;
25
24
  let { styles, vbWidth, vbHeight } = units;
25
+ let cx, cy;
26
26
 
27
27
  // کل چارت
28
28
  vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
@@ -32,7 +32,6 @@ export default class Speech {
32
32
  width = vbWidth; // ثابت می‌ماند همیشه
33
33
  height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
34
34
 
35
-
36
35
  const labels = dims.labels;
37
36
  this.labels = labels;
38
37
  // یک جدول 6*2 - ۲ سطر و ۶ ستون
@@ -57,11 +56,11 @@ export default class Speech {
57
56
  ];
58
57
 
59
58
  for (let i = 0; i < rows; i++) {
60
- x = cw / 2;
61
- y = ch / 2 + ch * i;
59
+ cx = cw / 2;
60
+ cy = ch / 2 + ch * i;
62
61
  for (let j = 0; j < columns; j++) {
63
- matrix[i][j] = { i, j, x, y };
64
- x += cw;
62
+ matrix[i][j] = { i, j, cx, cy };
63
+ cx += cw;
65
64
  }
66
65
  }
67
66
 
@@ -70,12 +69,15 @@ export default class Speech {
70
69
  // برای فرم های پیش چاپ شده انجام نمیشود
71
70
  !dims.hideContext &&
72
71
  matrix[0].forEach((cell, index) =>
73
- putText({ container: svg, value: labels[index], x: cell.x, y: cell.y, dx: 0, dy: 1, style }));
72
+ putText({
73
+ container: svg, value: labels[index],
74
+ x: cell.cx, y: cell.cy, dx: 0, dy: 1, style
75
+ }));
74
76
 
75
77
  style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
76
78
 
77
79
  const inputBox = {
78
- width: width / 5 * 0.70, height: height / 2 * 0.85,
80
+ width: width / 5 * 0.80, height: height / 2 * 0.95,
79
81
  rx: width / 100
80
82
  }
81
83
  // محاسبه کمان گردی بر اساس مقدار پهنا
@@ -85,14 +87,14 @@ export default class Speech {
85
87
  matrix[1].forEach((cell, index) => {
86
88
  // برای فرم های پیش چاپ شده باکس رسم نمیشود
87
89
  !dims.hideContext &&
88
- putCell({
89
- container: svg, x: cell.x, y: cell.y, dy: -1,
90
+ putRect({
91
+ container: svg, cx: cell.cx, cy: cell.cy, dy: -1,
90
92
  width: inputBox.width, height: inputBox.height,
91
93
  rx: inputBox.rx,
92
94
  });
93
95
  // مقدار نگه دارها
94
96
  if (!dims.forceInsert) {
95
- putText({ container: svg, value: "", x: cell.x, y: cell.y, style, name: labels[index] });
97
+ putText({ container: svg, value: "", x: cell.cx, y: cell.cy, style, name: labels[index] });
96
98
  } else {
97
99
  // برای فرم های مثل رسا استفاده میشود
98
100
  let name;
@@ -1,4 +1,3 @@
1
- import putCell from "../common/putCell.js";
2
1
  import putRect from "../common/putRect.js";
3
2
  import putText from "../common/putText.js";
4
3
  import putSVG from "../common/putSVG.js";
@@ -84,8 +83,8 @@ export default class Speech {
84
83
  matrix[1].forEach((cell, index) => {
85
84
  // برای فرم های پیش چاپ شده باکس رسم نمیشود
86
85
  // !dims.hideContext &&
87
- putCell({
88
- container, x: cell.x, y: cell.y, dy: -1,
86
+ putRect({
87
+ container, cx: cell.x, cy: cell.y, dy: -1,
89
88
  width: inputBox.width, height: inputBox.height,
90
89
  rx: inputBox.rx,
91
90
  });