Skip to content

Commit aa8bb55

Browse files
committed
更紧凑的布局
1 parent c224c1a commit aa8bb55

6 files changed

Lines changed: 118 additions & 85 deletions

File tree

dist/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@ var edaEsbuildExportName = (() => {
3636
function activate(status, arg) {
3737
}
3838
function about() {
39-
eda.sys_Dialog.showInformationMessage(displayName + " " + version + "\n" + description + "\n Github: https://github.com/klxf/eext-hilbert-creator", "\u5173\u4E8E");
39+
eda.sys_Dialog.showInformationMessage(
40+
displayName + " " + version + "\n" + description + "\n Github: https://github.com/klxf/eext-hilbert-creator",
41+
"\u5173\u4E8E"
42+
);
4043
}
4144
function openIframe() {
42-
eda.sys_IFrame.openIFrame("/iframe/index.html", 300, 600);
45+
eda.sys_IFrame.openIFrame("/iframe/index.html", 300, 345);
4346
}
4447
function openCounter1Iframe() {
45-
eda.sys_IFrame.openIFrame("/iframe/counter_1.html", 300, 465);
48+
eda.sys_IFrame.openIFrame("/iframe/counter_1.html", 340, 300);
4649
}
4750
return __toCommonJS(src_exports);
4851
})();

extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"uuid": "9cc258d2dded489c852ced6a70113396",
44
"displayName": "Hilbert Creator",
55
"description": "Hilbert Creator - 希尔伯特曲线生成器",
6-
"version": "1.3.1",
6+
"version": "1.3.2",
77
"engines": {
88
"publisher": "Mr_Fang <klxf[#]vip.qq.com>",
99
"eda": "^2.2.35"

iframe/counter_1.html

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,64 @@
99
<body>
1010
<div class="tablinks active" id="tab-1" onclick="openTab('counter-1')">计算线长</div>
1111
<div class="tablinks" id="tab-2" onclick="openTab('counter-2')">计算线宽</div>
12-
<div id="counter-1" class="tabcontent">
13-
<!-- 阻值 -->
14-
<label for="resistance-1">阻值(Ω):</label>
15-
<input type="number" id="resistance-1" name="resistance-1" value="5" min="0" step="0.01" />
12+
<div id="counter-1" class="container tabcontent">
13+
<div class="form-item">
14+
<label for="resistance-1">阻值(Ω):</label>
15+
<input type="number" id="resistance-1" name="resistance-1" value="5" min="0" step="0.01" />
16+
</div>
1617

17-
<!-- 铜片厚度 默认35 -->
18-
<label for="thickness-1">铜片厚度(μm):</label>
19-
<select id="thickness-1" name="thickness-1">
20-
<option value="12">12</option>
21-
<option value="18">18</option>
22-
<option value="35" selected>35</option>
23-
<option value="70">70</option>
24-
</select>
18+
<div class="form-item">
19+
<label for="thickness-1">铜片厚度(μm):</label>
20+
<select id="thickness-1" name="thickness-1">
21+
<option value="12">12</option>
22+
<option value="18">18</option>
23+
<option value="35" selected>35</option>
24+
<option value="70">70</option>
25+
</select>
26+
</div>
2527

26-
<!-- 线宽 -->
27-
<label for="lineWidth-1">线宽(mm):</label>
28-
<input type="number" id="lineWidth-1" name="lineWidth-1" value="0.254" min="0" step="0.001" />
28+
<div class="form-item">
29+
<label for="lineWidth-1">线宽(mm):</label>
30+
<input type="number" id="lineWidth-1" name="lineWidth-1" value="0.254" min="0" step="0.001" />
31+
</div>
2932

30-
<!-- 线长 -->
31-
<label for="length-1">线长(mm):</label>
32-
<input type="number" id="length-1" name="length-1" value="0" disabled />
33+
<div class="form-item">
34+
<label for="length-1">线长(mm):</label>
35+
<input type="number" id="length-1" name="length-1" value="0" disabled />
36+
</div>
3337

3438
<button id="calc-1">计算</button>
3539
</div>
36-
<div id="counter-2" class="tabcontent" style="display: none">
37-
<!-- 阻值 -->
38-
<label for="resistance-2">阻值(Ω):</label>
39-
<input type="number" id="resistance-2" name="resistance-2" value="5" min="0" step="0.01" />
40+
<div id="counter-2" class="container tabcontent" style="display: none">
41+
<div class="form-item">
42+
<label for="resistance-2">阻值(Ω):</label>
43+
<input type="number" id="resistance-2" name="resistance-2" value="5" min="0" step="0.01" />
44+
</div>
4045

41-
<!-- 铜片厚度 默认35 -->
42-
<label for="thickness-2">铜片厚度(μm):</label>
43-
<select id="thickness-2" name="thickness-2">
44-
<option value="12">12</option>
45-
<option value="18">18</option>
46-
<option value="35" selected>35</option>
47-
<option value="70">70</option>
48-
</select>
46+
<div class="form-item">
47+
<label for="thickness-2">铜片厚度(μm):</label>
48+
<select id="thickness-2" name="thickness-2">
49+
<option value="12">12</option>
50+
<option value="18">18</option>
51+
<option value="35" selected>35</option>
52+
<option value="70">70</option>
53+
</select>
54+
</div>
4955

50-
<!-- 线长 -->
51-
<label for="length-2"
52-
>线长(mm):<span id="select-tip-icon"><span>应用于此</span></span></label
53-
>
54-
<input type="number" id="length-2" name="length-2" value="100" min="0" step="0.001" />
56+
<div class="form-item">
57+
<label for="length-2">
58+
线长(mm):
59+
<span id="select-tip-icon">
60+
<span>应用于此</span>
61+
</span>
62+
</label>
63+
<input type="number" id="length-2" name="length-2" value="100" min="0" step="0.001" />
64+
</div>
5565

56-
<!-- 线宽 -->
57-
<label for="lineWidth-2">线宽(mm):</label>
58-
<input type="number" id="lineWidth-2" name="lineWidth-2" value="0" disabled />
66+
<div class="form-item">
67+
<label for="lineWidth-2">线宽(mm):</label>
68+
<input type="number" id="lineWidth-2" name="lineWidth-2" value="0" disabled />
69+
</div>
5970

6071
<button id="calc-2">计算</button>
6172
<button id="apply-2">应用于<span id="netName">HILBERT</span></button>

iframe/css/style.css

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,37 @@ body {
66
height: 100vh;
77
}
88

9-
div {
9+
body,
10+
html {
11+
overflow: hidden;
12+
}
13+
14+
.container {
1015
background-color: #fff;
1116
padding: 20px;
1217
border-radius: 8px;
1318
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
19+
max-width: 100%;
20+
}
21+
22+
.form-item {
23+
display: flex;
24+
align-items: baseline;
25+
margin-bottom: 6px;
26+
max-width: 100%;
1427
}
1528

1629
label {
17-
display: block;
18-
margin-bottom: 8px;
19-
font-weight: bold;
30+
flex: 0 0 45%;
31+
text-align: right;
2032
}
2133

2234
input[type='text'],
23-
input[type='number'] {
24-
width: calc(100% - 22px);
35+
input[type='number'],
36+
select {
37+
flex: 1;
38+
max-width: 50%;
2539
padding: 10px;
26-
margin-bottom: 20px;
2740
border: 1px solid #ccc;
2841
border-radius: 4px;
2942
box-sizing: border-box;
@@ -32,20 +45,12 @@ input[type='number'] {
3245
button {
3346
background-color: #007bff;
3447
color: #fff;
35-
padding: 10px 20px;
48+
padding: 6px 20px;
3649
border: none;
3750
border-radius: 4px;
3851
cursor: pointer;
3952
font-size: 16px;
40-
}
41-
42-
select {
43-
width: calc(100% - 22px);
44-
padding: 10px;
45-
margin-bottom: 20px;
46-
border: 1px solid #ccc;
47-
border-radius: 4px;
48-
box-sizing: border-box;
53+
margin-top: 8px;
4954
}
5055

5156
button:hover {
@@ -69,6 +74,7 @@ span#mode-tip-icon {
6974
min-height: 24px;
7075
min-width: 20px;
7176
position: absolute;
77+
right: 52px;
7278
cursor: pointer;
7379
}
7480

@@ -81,7 +87,7 @@ span#mode-tip-icon {
8187
display: none;
8288
position: absolute;
8389
top: -165px;
84-
left: 75px;
90+
right: -90px;
8591
transform: translateX(-50%);
8692
width: 150px;
8793
border: 1px solid #ccc;
@@ -123,6 +129,7 @@ span#mode-tip-icon {
123129
min-height: 24px;
124130
min-width: 20px;
125131
position: absolute;
132+
right: 42px;
126133
cursor: pointer;
127134
}
128135

iframe/index.html

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,46 @@
88
<script src="/iframe/js/main.js"></script>
99
</head>
1010
<body>
11-
<div>
12-
<!--<label for="net-name">网络名称:</label>
13-
<input type="text" id="net-name" name="net-name" value="test" />-->
11+
<div class="container">
12+
<div class="form-item">
13+
<label for="lineWidth">线宽(mm):</label>
14+
<input type="number" id="lineWidth" name="lineWidth" value="0.254" min="0" step="0.001" />
15+
</div>
1416

15-
<label for="lineWidth">线宽(mm):</label>
16-
<input type="number" id="lineWidth" name="lineWidth" value="0.254" min="0" step="0.001" />
17+
<div class="form-item">
18+
<label for="startX">起始点X坐标:</label>
19+
<input type="number" id="startX" name="startX" value="0" />
20+
</div>
1721

18-
<label for="startX">起始点X坐标:</label>
19-
<input type="number" id="startX" name="startX" value="0" />
22+
<div class="form-item">
23+
<label for="startY">起始点Y坐标:</label>
24+
<input type="number" id="startY" name="startY" value="0" />
25+
</div>
2026

21-
<label for="startY">起始点Y坐标:</label>
22-
<input type="number" id="startY" name="startY" value="0" />
27+
<div class="form-item">
28+
<label for="iterations">迭代次数:</label>
29+
<input type="number" id="iterations" name="iterations" value="5" min="1" />
30+
</div>
2331

24-
<label for="iterations">迭代次数:</label>
25-
<input type="number" id="iterations" name="iterations" value="5" min="1" />
32+
<div class="form-item">
33+
<label for="height">尺寸(mm):</label>
34+
<input type="number" id="height" name="height" value="20" />
35+
</div>
2636

27-
<label for="height">尺寸(mm):</label>
28-
<input type="number" id="height" name="height" value="20" />
29-
30-
<label for="mode"
31-
>模式:<span id="mode-tip-icon"><img src="/iframe/img/mode0.webp" id="mode-tip-img" alt="例子" /></span
32-
></label>
33-
<select id="mode" name="mode">
34-
<option value="0">0</option>
35-
<option value="1">1</option>
36-
<option value="2">2</option>
37-
<option value="3">3</option>
38-
</select>
37+
<div class="form-item">
38+
<label for="mode">
39+
模式:
40+
<span id="mode-tip-icon">
41+
<img src="/iframe/img/mode0.webp" id="mode-tip-img" alt="例子" />
42+
</span>
43+
</label>
44+
<select id="mode" name="mode">
45+
<option value="0">0</option>
46+
<option value="1">1</option>
47+
<option value="2">2</option>
48+
<option value="3">3</option>
49+
</select>
50+
</div>
3951

4052
<button id="draw">绘制</button>
4153
<button id="calc">计算</button>

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ export function about(): void {
2828
}
2929

3030
export function openIframe(): void {
31-
eda.sys_IFrame.openIFrame('/iframe/index.html', 300, 600);
31+
eda.sys_IFrame.openIFrame('/iframe/index.html', 300, 345);
3232
}
3333

3434
export function openCounter1Iframe(): void {
35-
eda.sys_IFrame.openIFrame('/iframe/counter_1.html', 300, 465);
35+
eda.sys_IFrame.openIFrame('/iframe/counter_1.html', 340, 300);
3636
}

0 commit comments

Comments
 (0)