geomui 0.5.4
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/README.md +58 -0
- package/dist/Drawing.svelte +303 -0
- package/dist/Drawing.svelte.d.ts +21 -0
- package/dist/DrawingList.svelte +66 -0
- package/dist/DrawingList.svelte.d.ts +17 -0
- package/dist/InputParams.svelte +453 -0
- package/dist/InputParams.svelte.d.ts +22 -0
- package/dist/LabelCheckbox.svelte +27 -0
- package/dist/LabelCheckbox.svelte.d.ts +14 -0
- package/dist/LocStorRead.svelte +56 -0
- package/dist/LocStorRead.svelte.d.ts +17 -0
- package/dist/LocStorTable.svelte +167 -0
- package/dist/LocStorTable.svelte.d.ts +18 -0
- package/dist/LocStorWrite.svelte +66 -0
- package/dist/LocStorWrite.svelte.d.ts +17 -0
- package/dist/ModalDiag.svelte +100 -0
- package/dist/ModalDiag.svelte.d.ts +22 -0
- package/dist/ModalImg.svelte +59 -0
- package/dist/ModalImg.svelte.d.ts +17 -0
- package/dist/OneDesign.svelte +32 -0
- package/dist/OneDesign.svelte.d.ts +18 -0
- package/dist/ParamDrawExport.svelte +195 -0
- package/dist/ParamDrawExport.svelte.d.ts +19 -0
- package/dist/SimpleDrawing.svelte +58 -0
- package/dist/SimpleDrawing.svelte.d.ts +20 -0
- package/dist/SubDesign.svelte +202 -0
- package/dist/SubDesign.svelte.d.ts +19 -0
- package/dist/TimeControl.svelte +107 -0
- package/dist/TimeControl.svelte.d.ts +19 -0
- package/dist/ZoomControl.svelte +106 -0
- package/dist/ZoomControl.svelte.d.ts +16 -0
- package/dist/downloadParams.d.ts +4 -0
- package/dist/downloadParams.js +42 -0
- package/dist/drawingLayers.d.ts +3 -0
- package/dist/drawingLayers.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/initStore.d.ts +5 -0
- package/dist/initStore.js +46 -0
- package/dist/storePVal.d.ts +6 -0
- package/dist/storePVal.js +4 -0
- package/dist/style/colors.scss +51 -0
- package/dist/style/styling.scss +23 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# create-svelte
|
|
2
|
+
|
|
3
|
+
Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
|
|
4
|
+
|
|
5
|
+
Read more about creating a library [in the docs](https://kit.svelte.dev/docs/packaging).
|
|
6
|
+
|
|
7
|
+
## Creating a project
|
|
8
|
+
|
|
9
|
+
If you're seeing this, you've probably already done this step. Congrats!
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# create a new project in the current directory
|
|
13
|
+
npm create svelte@latest
|
|
14
|
+
|
|
15
|
+
# create a new project in my-app
|
|
16
|
+
npm create svelte@latest my-app
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Developing
|
|
20
|
+
|
|
21
|
+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm run dev
|
|
25
|
+
|
|
26
|
+
# or start the server and open the app in a new browser tab
|
|
27
|
+
npm run dev -- --open
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
|
|
31
|
+
|
|
32
|
+
## Building
|
|
33
|
+
|
|
34
|
+
To build your library:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run package
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
To create a production version of your showcase app:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run build
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can preview the production build with `npm run preview`.
|
|
47
|
+
|
|
48
|
+
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
|
49
|
+
|
|
50
|
+
## Publishing
|
|
51
|
+
|
|
52
|
+
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
|
|
53
|
+
|
|
54
|
+
To publish your library to [npm](https://www.npmjs.com):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm publish
|
|
58
|
+
```
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
<script>import TimeControl from "./TimeControl.svelte";
|
|
2
|
+
import ZoomControl from "./ZoomControl.svelte";
|
|
3
|
+
import LabelCheckbox from "./LabelCheckbox.svelte";
|
|
4
|
+
import {
|
|
5
|
+
colors,
|
|
6
|
+
canvas2point,
|
|
7
|
+
adjustCenter,
|
|
8
|
+
adjustRect,
|
|
9
|
+
adjustScale,
|
|
10
|
+
adjustTranslate,
|
|
11
|
+
mergeFaces
|
|
12
|
+
} from "geometrix";
|
|
13
|
+
import { storePV } from "./storePVal";
|
|
14
|
+
import { dLayers } from "./drawingLayers";
|
|
15
|
+
import { onMount } from "svelte";
|
|
16
|
+
export let pDef;
|
|
17
|
+
export let fgeom;
|
|
18
|
+
export let optFaces;
|
|
19
|
+
export let selFace;
|
|
20
|
+
export let simTime = 0;
|
|
21
|
+
const c_ParametrixAll = "ParametrixAll";
|
|
22
|
+
let windowWidth;
|
|
23
|
+
let canvasFull;
|
|
24
|
+
let canvasZoom;
|
|
25
|
+
const canvas_size_min = 400;
|
|
26
|
+
let aFigure;
|
|
27
|
+
let cAdjust;
|
|
28
|
+
let zAdjust;
|
|
29
|
+
function canvasRedrawFull(iLayers) {
|
|
30
|
+
const ctx1 = canvasFull.getContext("2d");
|
|
31
|
+
ctx1.clearRect(0, 0, ctx1.canvas.width, ctx1.canvas.height);
|
|
32
|
+
try {
|
|
33
|
+
cAdjust = aFigure.getAdjustFull(ctx1.canvas.width, ctx1.canvas.height);
|
|
34
|
+
aFigure.draw(ctx1, cAdjust, iLayers);
|
|
35
|
+
} catch (emsg) {
|
|
36
|
+
console.log(emsg);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function canvasRedrawZoom(iLayers) {
|
|
40
|
+
const ctx2 = canvasZoom.getContext("2d");
|
|
41
|
+
ctx2.clearRect(0, 0, ctx2.canvas.width, ctx2.canvas.height);
|
|
42
|
+
try {
|
|
43
|
+
if (zAdjust === void 0 || zAdjust.init === 0) {
|
|
44
|
+
zAdjust = aFigure.getAdjustZoom(ctx2.canvas.width, ctx2.canvas.height);
|
|
45
|
+
}
|
|
46
|
+
aFigure.draw(ctx2, zAdjust, iLayers);
|
|
47
|
+
} catch (emsg) {
|
|
48
|
+
console.log(emsg);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function canvasSetSize() {
|
|
52
|
+
const ctx1 = canvasFull.getContext("2d");
|
|
53
|
+
const canvas_size = Math.max(0.4 * windowWidth, canvas_size_min);
|
|
54
|
+
ctx1.canvas.width = canvas_size;
|
|
55
|
+
ctx1.canvas.height = canvas_size;
|
|
56
|
+
}
|
|
57
|
+
function canvasResize() {
|
|
58
|
+
canvasSetSize();
|
|
59
|
+
canvasRedrawFull($dLayers);
|
|
60
|
+
canvasRedrawZoom($dLayers);
|
|
61
|
+
}
|
|
62
|
+
let domInit = 0;
|
|
63
|
+
function checkFace(iFaces, iFace) {
|
|
64
|
+
let rFace = iFace;
|
|
65
|
+
if (iFaces.length === 0) {
|
|
66
|
+
console.log(`warn404: Drawing has an empty face list`);
|
|
67
|
+
} else {
|
|
68
|
+
const FaceList2 = iFaces.slice();
|
|
69
|
+
FaceList2.push(c_ParametrixAll);
|
|
70
|
+
if (!FaceList2.includes(rFace)) {
|
|
71
|
+
rFace = iFaces[0];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return rFace;
|
|
75
|
+
}
|
|
76
|
+
function geomRedrawSub(iSimTime, pVal, iFace, iLayers) {
|
|
77
|
+
const FigList = fgeom(iSimTime, pVal).fig;
|
|
78
|
+
const FigListKeys = Object.keys(FigList);
|
|
79
|
+
const sFace = checkFace(FigListKeys, iFace);
|
|
80
|
+
selFace = sFace;
|
|
81
|
+
if (FigListKeys.includes(sFace)) {
|
|
82
|
+
aFigure = FigList[sFace];
|
|
83
|
+
} else {
|
|
84
|
+
aFigure = mergeFaces(FigList);
|
|
85
|
+
}
|
|
86
|
+
canvasRedrawFull(iLayers);
|
|
87
|
+
canvasRedrawZoom(iLayers);
|
|
88
|
+
}
|
|
89
|
+
function geomRedraw(iSimTime, iFace) {
|
|
90
|
+
geomRedrawSub(iSimTime, $storePV[pDef.partName], iFace, $dLayers);
|
|
91
|
+
}
|
|
92
|
+
onMount(() => {
|
|
93
|
+
canvasSetSize();
|
|
94
|
+
geomRedraw(simTime, selFace);
|
|
95
|
+
domInit = 1;
|
|
96
|
+
});
|
|
97
|
+
$: {
|
|
98
|
+
if (domInit === 1) {
|
|
99
|
+
geomRedrawSub(simTime, $storePV[pDef.partName], selFace, $dLayers);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function zoomClick(event) {
|
|
103
|
+
switch (event.detail.action) {
|
|
104
|
+
case "zoomInit":
|
|
105
|
+
zAdjust.init = 0;
|
|
106
|
+
break;
|
|
107
|
+
case "zoomIn":
|
|
108
|
+
zAdjust = adjustScale(0.7, zAdjust);
|
|
109
|
+
break;
|
|
110
|
+
case "zoomOut":
|
|
111
|
+
zAdjust = adjustScale(1.3, zAdjust);
|
|
112
|
+
break;
|
|
113
|
+
case "moveLeft":
|
|
114
|
+
zAdjust.xMin += -0.2 * zAdjust.xyDiff;
|
|
115
|
+
break;
|
|
116
|
+
case "moveRight":
|
|
117
|
+
zAdjust.xMin += 0.2 * zAdjust.xyDiff;
|
|
118
|
+
break;
|
|
119
|
+
case "moveUp":
|
|
120
|
+
zAdjust.yMin += 0.2 * zAdjust.xyDiff;
|
|
121
|
+
break;
|
|
122
|
+
case "moveDown":
|
|
123
|
+
zAdjust.yMin += -0.2 * zAdjust.xyDiff;
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
console.log(`ERR423: ${event.detail.action} has no case!`);
|
|
127
|
+
}
|
|
128
|
+
canvasRedrawZoom($dLayers);
|
|
129
|
+
}
|
|
130
|
+
const mouseDelayMax = 3e3;
|
|
131
|
+
const mouseDiffClick = 10;
|
|
132
|
+
const mouseDiffRatioSelect = 3;
|
|
133
|
+
let mouseF = { timestamp: 0, offsetX: 0, offsetY: 0 };
|
|
134
|
+
function cFullMouseDn(eve) {
|
|
135
|
+
if (eve.button === 0) {
|
|
136
|
+
mouseF.timestamp = Date.now();
|
|
137
|
+
mouseF.offsetX = eve.offsetX;
|
|
138
|
+
mouseF.offsetY = eve.offsetY;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function cFullMouseUp(eve) {
|
|
142
|
+
if (eve.button === 0) {
|
|
143
|
+
if (Date.now() - mouseF.timestamp < mouseDelayMax) {
|
|
144
|
+
const diffX = Math.abs(mouseF.offsetX - eve.offsetX);
|
|
145
|
+
const diffY = Math.abs(mouseF.offsetY - eve.offsetY);
|
|
146
|
+
if (diffX < mouseDiffClick && diffY < mouseDiffClick) {
|
|
147
|
+
const [px, py] = canvas2point(eve.offsetX, eve.offsetY, cAdjust);
|
|
148
|
+
zAdjust = adjustCenter(px, py, zAdjust);
|
|
149
|
+
geomRedraw(simTime, selFace);
|
|
150
|
+
}
|
|
151
|
+
if (diffX > mouseDiffClick && diffY > mouseDiffClick) {
|
|
152
|
+
const diffRatio1 = diffX / diffY;
|
|
153
|
+
const diffRatio2 = 1 / diffRatio1;
|
|
154
|
+
if (diffRatio1 < mouseDiffRatioSelect && diffRatio2 < mouseDiffRatioSelect) {
|
|
155
|
+
const [p1x, p1y] = canvas2point(eve.offsetX, eve.offsetY, cAdjust);
|
|
156
|
+
const [p2x, p2y] = canvas2point(mouseF.offsetX, mouseF.offsetY, cAdjust);
|
|
157
|
+
zAdjust = adjustRect(p1x, p1y, p2x, p2y, canvas_size_min, canvas_size_min);
|
|
158
|
+
geomRedraw(simTime, selFace);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
console.log(`Warn205: ignore ${eve.offsetX} ${eve.offsetY} because too slow`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function cFullMouseMove(eve) {
|
|
167
|
+
const ctx1 = canvasFull.getContext("2d");
|
|
168
|
+
if (eve.buttons === 1) {
|
|
169
|
+
const diffX = eve.offsetX - mouseF.offsetX;
|
|
170
|
+
const diffY = eve.offsetY - mouseF.offsetY;
|
|
171
|
+
canvasRedrawFull($dLayers);
|
|
172
|
+
ctx1.beginPath();
|
|
173
|
+
ctx1.rect(mouseF.offsetX, mouseF.offsetY, diffX, diffY);
|
|
174
|
+
ctx1.strokeStyle = colors.mouse;
|
|
175
|
+
ctx1.stroke();
|
|
176
|
+
}
|
|
177
|
+
if ($dLayers.ruler) {
|
|
178
|
+
const [p1x, p1y] = canvas2point(eve.offsetX, eve.offsetY, cAdjust);
|
|
179
|
+
ctx1.clearRect(5, 5, 200, 25);
|
|
180
|
+
ctx1.font = "15px Arial";
|
|
181
|
+
ctx1.fillStyle = colors.ruler;
|
|
182
|
+
ctx1.fillText(`x: ${p1x.toFixed(4)} y: ${p1y.toFixed(4)}`, 5, 20);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
let mouseZx;
|
|
186
|
+
let mouseZy;
|
|
187
|
+
let mouseZadjust;
|
|
188
|
+
function cZoomMouseDn(eve) {
|
|
189
|
+
if (eve.button === 0) {
|
|
190
|
+
const [p1x, p1y] = canvas2point(eve.offsetX, eve.offsetY, zAdjust);
|
|
191
|
+
mouseZx = p1x;
|
|
192
|
+
mouseZy = p1y;
|
|
193
|
+
mouseZadjust = structuredClone(zAdjust);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function cZoomMouseMove(eve) {
|
|
197
|
+
if (eve.buttons === 1) {
|
|
198
|
+
const [p2x, p2y] = canvas2point(eve.offsetX, eve.offsetY, mouseZadjust);
|
|
199
|
+
zAdjust = adjustTranslate(mouseZx, mouseZy, p2x, p2y, mouseZadjust);
|
|
200
|
+
canvasRedrawZoom($dLayers);
|
|
201
|
+
} else {
|
|
202
|
+
if ($dLayers.ruler) {
|
|
203
|
+
const ctx2 = canvasZoom.getContext("2d");
|
|
204
|
+
const [p2x, p2y] = canvas2point(eve.offsetX, eve.offsetY, zAdjust);
|
|
205
|
+
ctx2.clearRect(5, 5, 200, 25);
|
|
206
|
+
ctx2.font = "15px Arial";
|
|
207
|
+
ctx2.fillStyle = colors.ruler;
|
|
208
|
+
ctx2.fillText(`x: ${p2x.toFixed(4)} y: ${p2y.toFixed(4)}`, 5, 20);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function cZoomWheel(eve) {
|
|
213
|
+
if (eve.deltaY > 0) {
|
|
214
|
+
zAdjust = adjustScale(0.7, zAdjust);
|
|
215
|
+
} else {
|
|
216
|
+
zAdjust = adjustScale(1.3, zAdjust);
|
|
217
|
+
}
|
|
218
|
+
canvasRedrawZoom($dLayers);
|
|
219
|
+
}
|
|
220
|
+
</script>
|
|
221
|
+
|
|
222
|
+
<svelte:window bind:innerWidth={windowWidth} on:resize={canvasResize} />
|
|
223
|
+
<section>
|
|
224
|
+
<h2>
|
|
225
|
+
Drawing
|
|
226
|
+
<select bind:value={selFace}>
|
|
227
|
+
{#each optFaces as optFace}
|
|
228
|
+
<option value={optFace}>{optFace}</option>
|
|
229
|
+
{/each}
|
|
230
|
+
<option value={c_ParametrixAll}>All faces merged</option>
|
|
231
|
+
</select>
|
|
232
|
+
</h2>
|
|
233
|
+
<LabelCheckbox />
|
|
234
|
+
<div class="rack">
|
|
235
|
+
<canvas
|
|
236
|
+
class="full"
|
|
237
|
+
width={canvas_size_min}
|
|
238
|
+
height={canvas_size_min}
|
|
239
|
+
bind:this={canvasFull}
|
|
240
|
+
on:mousedown={cFullMouseDn}
|
|
241
|
+
on:mouseup={cFullMouseUp}
|
|
242
|
+
on:mousemove={cFullMouseMove}
|
|
243
|
+
/>
|
|
244
|
+
<TimeControl
|
|
245
|
+
tMax={pDef.sim.tMax}
|
|
246
|
+
tStep={pDef.sim.tStep}
|
|
247
|
+
tUpdate={pDef.sim.tUpdate}
|
|
248
|
+
bind:simTime
|
|
249
|
+
/>
|
|
250
|
+
</div>
|
|
251
|
+
<div class="rack">
|
|
252
|
+
<canvas
|
|
253
|
+
class="zoom"
|
|
254
|
+
width={canvas_size_min}
|
|
255
|
+
height={canvas_size_min}
|
|
256
|
+
bind:this={canvasZoom}
|
|
257
|
+
on:mousedown={cZoomMouseDn}
|
|
258
|
+
on:mousemove={cZoomMouseMove}
|
|
259
|
+
on:wheel|preventDefault={cZoomWheel}
|
|
260
|
+
/>
|
|
261
|
+
<ZoomControl on:myevent={zoomClick} />
|
|
262
|
+
</div>
|
|
263
|
+
</section>
|
|
264
|
+
|
|
265
|
+
<style>/*
|
|
266
|
+
$canvas-point: grey;
|
|
267
|
+
|
|
268
|
+
// export to js
|
|
269
|
+
:export {
|
|
270
|
+
colorCanvasPoint: $canvas-point;
|
|
271
|
+
}
|
|
272
|
+
*/
|
|
273
|
+
section > h2 {
|
|
274
|
+
color: grey;
|
|
275
|
+
margin: 1rem 0.5rem 0;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
section > h2 > select {
|
|
279
|
+
/*display: inline-block;*/
|
|
280
|
+
height: 1.6rem;
|
|
281
|
+
/*width: 1.6rem;*/
|
|
282
|
+
color: darkBlue;
|
|
283
|
+
font-size: 0.8rem;
|
|
284
|
+
font-weight: 400;
|
|
285
|
+
padding: 0.2rem 0.4rem 0.2rem;
|
|
286
|
+
border-style: solid;
|
|
287
|
+
border-width: 0.1rem;
|
|
288
|
+
border-radius: 0.2rem;
|
|
289
|
+
border-color: darkBlue;
|
|
290
|
+
margin: 0.5rem;
|
|
291
|
+
background-color: lightBlue;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
section > div.rack {
|
|
295
|
+
display: inline-block;
|
|
296
|
+
margin: 0 1rem 0;
|
|
297
|
+
text-align: center;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
section > div.rack > canvas {
|
|
301
|
+
background-color: pink;
|
|
302
|
+
margin: 0.2rem;
|
|
303
|
+
}</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { tParamDef, tGeomFunc } from 'geometrix';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
pDef: tParamDef;
|
|
6
|
+
fgeom: tGeomFunc;
|
|
7
|
+
optFaces: string[];
|
|
8
|
+
selFace: string;
|
|
9
|
+
simTime?: number | undefined;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
};
|
|
16
|
+
export type DrawingProps = typeof __propDef.props;
|
|
17
|
+
export type DrawingEvents = typeof __propDef.events;
|
|
18
|
+
export type DrawingSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Drawing extends SvelteComponent<DrawingProps, DrawingEvents, DrawingSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script>import ModalImg from "./ModalImg.svelte";
|
|
2
|
+
import { base } from "$app/paths";
|
|
3
|
+
export let pDef;
|
|
4
|
+
function getSvgList(ipDef) {
|
|
5
|
+
const rList = [];
|
|
6
|
+
for (const value of Object.values(ipDef.paramSvg)) {
|
|
7
|
+
if (!rList.includes(value)) {
|
|
8
|
+
rList.push(value);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return rList;
|
|
12
|
+
}
|
|
13
|
+
function getSvgList2(partName) {
|
|
14
|
+
if (partName === "impossible_part_name") {
|
|
15
|
+
}
|
|
16
|
+
const lList = getSvgList(pDef);
|
|
17
|
+
const rList2 = [];
|
|
18
|
+
for (const svg of lList) {
|
|
19
|
+
rList2.push(`${base}/${svg}`);
|
|
20
|
+
}
|
|
21
|
+
return rList2;
|
|
22
|
+
}
|
|
23
|
+
let lSvg = [];
|
|
24
|
+
$:
|
|
25
|
+
lSvg = getSvgList2(pDef.partName);
|
|
26
|
+
let modalImg = false;
|
|
27
|
+
let svgPath;
|
|
28
|
+
function showSvg(iSvgPath) {
|
|
29
|
+
svgPath = iSvgPath;
|
|
30
|
+
modalImg = true;
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<section>
|
|
35
|
+
<ModalImg bind:modalOpen={modalImg} {svgPath} />
|
|
36
|
+
{#each lSvg as iSvg}
|
|
37
|
+
<button on:click={() => showSvg(iSvg)}>
|
|
38
|
+
<img src={iSvg} alt={iSvg} />
|
|
39
|
+
</button>
|
|
40
|
+
{/each}
|
|
41
|
+
</section>
|
|
42
|
+
|
|
43
|
+
<style>/*
|
|
44
|
+
$canvas-point: grey;
|
|
45
|
+
|
|
46
|
+
// export to js
|
|
47
|
+
:export {
|
|
48
|
+
colorCanvasPoint: $canvas-point;
|
|
49
|
+
}
|
|
50
|
+
*/
|
|
51
|
+
section {
|
|
52
|
+
margin: 1rem;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
section > button {
|
|
56
|
+
margin: 0.2rem;
|
|
57
|
+
border: none;
|
|
58
|
+
padding: 0;
|
|
59
|
+
font-size: 0.6rem;
|
|
60
|
+
background-color: white;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
section > button > img {
|
|
64
|
+
max-width: 200px;
|
|
65
|
+
max-height: 200px;
|
|
66
|
+
}</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { tParamDef } from 'geometrix';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
pDef: tParamDef;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type DrawingListProps = typeof __propDef.props;
|
|
13
|
+
export type DrawingListEvents = typeof __propDef.events;
|
|
14
|
+
export type DrawingListSlots = typeof __propDef.slots;
|
|
15
|
+
export default class DrawingList extends SvelteComponent<DrawingListProps, DrawingListEvents, DrawingListSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|