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
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<script>import {
|
|
2
|
+
EFormat,
|
|
3
|
+
fileBinContent,
|
|
4
|
+
fileTextContent,
|
|
5
|
+
fileSuffix,
|
|
6
|
+
fileMime,
|
|
7
|
+
fileBin
|
|
8
|
+
} from "geometrix";
|
|
9
|
+
import InputParams from "./InputParams.svelte";
|
|
10
|
+
import Drawing from "./Drawing.svelte";
|
|
11
|
+
import SubDesign from "./SubDesign.svelte";
|
|
12
|
+
import { storePV } from "./storePVal";
|
|
13
|
+
export let pDef;
|
|
14
|
+
export let fgeom;
|
|
15
|
+
export let pLink;
|
|
16
|
+
function checkWarn(txt) {
|
|
17
|
+
let rWarn = true;
|
|
18
|
+
const re = /warn/i;
|
|
19
|
+
if (txt.search(re) < 0) {
|
|
20
|
+
rWarn = false;
|
|
21
|
+
}
|
|
22
|
+
return rWarn;
|
|
23
|
+
}
|
|
24
|
+
let optFaces = [];
|
|
25
|
+
let exportFace;
|
|
26
|
+
let selFace;
|
|
27
|
+
let simTime = 0;
|
|
28
|
+
let logValue = "Dummy initial\nWill be replaced during onMount\n";
|
|
29
|
+
let calcErr = false;
|
|
30
|
+
let calcWarn = false;
|
|
31
|
+
let subD = {};
|
|
32
|
+
function paramChange2(iPageName) {
|
|
33
|
+
const mydate = (/* @__PURE__ */ new Date()).toLocaleTimeString();
|
|
34
|
+
logValue = `Geometry ${iPageName} computed at ${mydate}
|
|
35
|
+
`;
|
|
36
|
+
const geome = fgeom(simTime, $storePV[pDef.partName]);
|
|
37
|
+
logValue += geome.logstr;
|
|
38
|
+
calcErr = geome.calcErr;
|
|
39
|
+
calcWarn = checkWarn(geome.logstr);
|
|
40
|
+
optFaces = Object.keys(geome.fig);
|
|
41
|
+
exportFace = "zip";
|
|
42
|
+
subD = geome.sub;
|
|
43
|
+
}
|
|
44
|
+
function paramChange() {
|
|
45
|
+
paramChange2(pDef.partName);
|
|
46
|
+
}
|
|
47
|
+
$:
|
|
48
|
+
paramChange2(pDef.partName);
|
|
49
|
+
function download_binFile(fName, fContent) {
|
|
50
|
+
const elem_a_download = document.createElement("a");
|
|
51
|
+
const payload = URL.createObjectURL(fContent);
|
|
52
|
+
elem_a_download.setAttribute("href", payload);
|
|
53
|
+
elem_a_download.setAttribute("download", fName);
|
|
54
|
+
elem_a_download.click();
|
|
55
|
+
elem_a_download.remove();
|
|
56
|
+
URL.revokeObjectURL(payload);
|
|
57
|
+
}
|
|
58
|
+
function download_textFile(fName, fContent, fMime) {
|
|
59
|
+
const elem_a_download = document.createElement("a");
|
|
60
|
+
const payload = "data:" + fMime + ";utf-8," + encodeURIComponent(fContent);
|
|
61
|
+
elem_a_download.setAttribute("href", payload);
|
|
62
|
+
elem_a_download.setAttribute("download", fName);
|
|
63
|
+
elem_a_download.click();
|
|
64
|
+
elem_a_download.remove();
|
|
65
|
+
}
|
|
66
|
+
function dateString() {
|
|
67
|
+
const re1 = /[-:]/g;
|
|
68
|
+
const re2 = /\..*$/;
|
|
69
|
+
const rDateStr = (/* @__PURE__ */ new Date()).toISOString().replace(re1, "").replace(re2, "").replace("T", "_");
|
|
70
|
+
return rDateStr;
|
|
71
|
+
}
|
|
72
|
+
async function downloadExport(iExportFace) {
|
|
73
|
+
const reSvg = /^svg_/;
|
|
74
|
+
const reDxf = /^dxf_/;
|
|
75
|
+
let exportFormat = EFormat.eSVG;
|
|
76
|
+
let nFace = "all";
|
|
77
|
+
if (iExportFace.match(reSvg)) {
|
|
78
|
+
exportFormat = EFormat.eSVG;
|
|
79
|
+
nFace = iExportFace.replace(reSvg, "");
|
|
80
|
+
} else if (iExportFace.match(reDxf)) {
|
|
81
|
+
exportFormat = EFormat.eDXF;
|
|
82
|
+
nFace = iExportFace.replace(reDxf, "");
|
|
83
|
+
} else if (iExportFace === "allsvg") {
|
|
84
|
+
exportFormat = EFormat.eSVGALL;
|
|
85
|
+
} else if (iExportFace === "alldxf") {
|
|
86
|
+
exportFormat = EFormat.eDXFALL;
|
|
87
|
+
} else if (iExportFace === "pax") {
|
|
88
|
+
exportFormat = EFormat.ePAX;
|
|
89
|
+
} else if (iExportFace === "oscad") {
|
|
90
|
+
exportFormat = EFormat.eOPENSCAD;
|
|
91
|
+
} else if (iExportFace === "ojscad") {
|
|
92
|
+
exportFormat = EFormat.eJSCAD;
|
|
93
|
+
} else if (iExportFace === "zip") {
|
|
94
|
+
exportFormat = EFormat.eZIP;
|
|
95
|
+
} else {
|
|
96
|
+
console.log(`err883: downloadExport iExportFace ${iExportFace} invalid`);
|
|
97
|
+
}
|
|
98
|
+
const fSuffix = fileSuffix(exportFormat);
|
|
99
|
+
const fMime = fileMime(exportFormat);
|
|
100
|
+
const fBin = fileBin(exportFormat);
|
|
101
|
+
const fName = pDef.partName + "_" + nFace + "_" + dateString() + fSuffix;
|
|
102
|
+
if (fBin) {
|
|
103
|
+
const fContent = await fileBinContent(
|
|
104
|
+
fgeom,
|
|
105
|
+
simTime,
|
|
106
|
+
$storePV[pDef.partName],
|
|
107
|
+
exportFormat
|
|
108
|
+
);
|
|
109
|
+
download_binFile(fName, fContent);
|
|
110
|
+
} else {
|
|
111
|
+
const fContent = fileTextContent(fgeom, $storePV[pDef.partName], nFace, exportFormat);
|
|
112
|
+
download_textFile(fName, fContent, fMime);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async function downloadExport2() {
|
|
116
|
+
await downloadExport(exportFace);
|
|
117
|
+
}
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<InputParams {pDef} on:paramChg={paramChange} {fgeom} {selFace} {simTime} />
|
|
121
|
+
<section>
|
|
122
|
+
<h2>Log</h2>
|
|
123
|
+
<textarea
|
|
124
|
+
rows="5"
|
|
125
|
+
cols="94"
|
|
126
|
+
readonly
|
|
127
|
+
wrap="off"
|
|
128
|
+
value={logValue}
|
|
129
|
+
class:colorErr={calcErr}
|
|
130
|
+
class:colorWarn={calcWarn}
|
|
131
|
+
/>
|
|
132
|
+
</section>
|
|
133
|
+
<Drawing {pDef} {fgeom} {optFaces} bind:selFace bind:simTime />
|
|
134
|
+
<section>
|
|
135
|
+
<h2>Export</h2>
|
|
136
|
+
<select bind:value={exportFace}>
|
|
137
|
+
{#each optFaces as optFace}
|
|
138
|
+
<option value="svg_{optFace}">face {optFace} as svg</option>
|
|
139
|
+
{/each}
|
|
140
|
+
<option value="allsvg">all faces merged as svg</option>
|
|
141
|
+
{#each optFaces as optFace}
|
|
142
|
+
<option value="dxf_{optFace}">face {optFace} as dxf</option>
|
|
143
|
+
{/each}
|
|
144
|
+
<option value="alldxf">all faces merged as dxf</option>
|
|
145
|
+
<option value="pax">all faces as pax.json</option>
|
|
146
|
+
<option value="oscad">all faces as openscad.scad</option>
|
|
147
|
+
<option value="ojscad">all faces as OpenJScad.js</option>
|
|
148
|
+
<option value="zip">all faces and more as zip</option>
|
|
149
|
+
</select>
|
|
150
|
+
<button on:click={downloadExport2}>Save to File</button>
|
|
151
|
+
<SubDesign {subD} origPartName={pDef.partName} {pLink} />
|
|
152
|
+
</section>
|
|
153
|
+
|
|
154
|
+
<style>/*
|
|
155
|
+
$canvas-point: grey;
|
|
156
|
+
|
|
157
|
+
// export to js
|
|
158
|
+
:export {
|
|
159
|
+
colorCanvasPoint: $canvas-point;
|
|
160
|
+
}
|
|
161
|
+
*/
|
|
162
|
+
section > h2 {
|
|
163
|
+
color: grey;
|
|
164
|
+
margin: 1rem 0.5rem 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
section > textarea {
|
|
168
|
+
/*resize: horizontal;*/
|
|
169
|
+
margin-left: 0.5rem;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
section > textarea.colorWarn {
|
|
173
|
+
background-color: orange;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
section > textarea.colorErr {
|
|
177
|
+
background-color: violet;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
section > button,
|
|
181
|
+
section > select {
|
|
182
|
+
/*display: inline-block;*/
|
|
183
|
+
height: 1.6rem;
|
|
184
|
+
/*width: 1.6rem;*/
|
|
185
|
+
color: darkBlue;
|
|
186
|
+
font-size: 0.8rem;
|
|
187
|
+
font-weight: 400;
|
|
188
|
+
padding: 0.2rem 0.4rem 0.2rem;
|
|
189
|
+
border-style: solid;
|
|
190
|
+
border-width: 0.1rem;
|
|
191
|
+
border-radius: 0.2rem;
|
|
192
|
+
border-color: darkBlue;
|
|
193
|
+
margin: 0.5rem;
|
|
194
|
+
background-color: lightBlue;
|
|
195
|
+
}</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { tParamDef, tGeomFunc, tAllLink } from 'geometrix';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
pDef: tParamDef;
|
|
6
|
+
fgeom: tGeomFunc;
|
|
7
|
+
pLink: tAllLink;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type ParamDrawExportProps = typeof __propDef.props;
|
|
15
|
+
export type ParamDrawExportEvents = typeof __propDef.events;
|
|
16
|
+
export type ParamDrawExportSlots = typeof __propDef.slots;
|
|
17
|
+
export default class ParamDrawExport extends SvelteComponent<ParamDrawExportProps, ParamDrawExportEvents, ParamDrawExportSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script>import { copyLayers, mergeFaces } from "geometrix";
|
|
2
|
+
import { storePV } from "./storePVal";
|
|
3
|
+
import { dLayers } from "./drawingLayers";
|
|
4
|
+
import { onMount } from "svelte";
|
|
5
|
+
export let pageName;
|
|
6
|
+
export let fgeom;
|
|
7
|
+
export let selFace;
|
|
8
|
+
export let simTime = 0;
|
|
9
|
+
let canvasMini;
|
|
10
|
+
const canvas_size_mini = 200;
|
|
11
|
+
let mAdjust;
|
|
12
|
+
function canvasRedrawMini(aFigure, iLayers) {
|
|
13
|
+
const sLayers = copyLayers(iLayers);
|
|
14
|
+
sLayers.ruler = false;
|
|
15
|
+
const ctx1 = canvasMini.getContext("2d");
|
|
16
|
+
ctx1.clearRect(0, 0, ctx1.canvas.width, ctx1.canvas.height);
|
|
17
|
+
try {
|
|
18
|
+
mAdjust = aFigure.getAdjustFull(ctx1.canvas.width, ctx1.canvas.height);
|
|
19
|
+
aFigure.draw(ctx1, mAdjust, sLayers);
|
|
20
|
+
} catch (emsg) {
|
|
21
|
+
console.log(emsg);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
let domInit = 0;
|
|
25
|
+
function geomRedraw(iSimTime, ipVal, iFace, iLayers) {
|
|
26
|
+
const FigList = fgeom(iSimTime, ipVal).fig;
|
|
27
|
+
if (Object.keys(FigList).includes(iFace)) {
|
|
28
|
+
const aFigure = FigList[iFace];
|
|
29
|
+
canvasRedrawMini(aFigure, iLayers);
|
|
30
|
+
} else {
|
|
31
|
+
const aFigure = mergeFaces(FigList);
|
|
32
|
+
canvasRedrawMini(aFigure, iLayers);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
onMount(() => {
|
|
36
|
+
geomRedraw(simTime, $storePV[pageName], selFace, $dLayers);
|
|
37
|
+
domInit = 1;
|
|
38
|
+
});
|
|
39
|
+
$: {
|
|
40
|
+
if (domInit === 1) {
|
|
41
|
+
geomRedraw(simTime, $storePV[pageName], selFace, $dLayers);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<canvas class="mini" width={canvas_size_mini} height={canvas_size_mini} bind:this={canvasMini} />
|
|
47
|
+
|
|
48
|
+
<style>/*
|
|
49
|
+
$canvas-point: grey;
|
|
50
|
+
|
|
51
|
+
// export to js
|
|
52
|
+
:export {
|
|
53
|
+
colorCanvasPoint: $canvas-point;
|
|
54
|
+
}
|
|
55
|
+
*/
|
|
56
|
+
canvas {
|
|
57
|
+
background-color: pink;
|
|
58
|
+
}</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { tGeomFunc } from 'geometrix';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
pageName: string;
|
|
6
|
+
fgeom: tGeomFunc;
|
|
7
|
+
selFace: string;
|
|
8
|
+
simTime?: number | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export type SimpleDrawingProps = typeof __propDef.props;
|
|
16
|
+
export type SimpleDrawingEvents = typeof __propDef.events;
|
|
17
|
+
export type SimpleDrawingSlots = typeof __propDef.slots;
|
|
18
|
+
export default class SimpleDrawing extends SvelteComponent<SimpleDrawingProps, SimpleDrawingEvents, SimpleDrawingSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
<script>import { ffix, radToDeg, paramListToVal } from "geometrix";
|
|
2
|
+
import { downloadParams } from "./downloadParams";
|
|
3
|
+
import { updateStore } from "./initStore";
|
|
4
|
+
import { base } from "$app/paths";
|
|
5
|
+
import { goto } from "$app/navigation";
|
|
6
|
+
export let subD = {};
|
|
7
|
+
export let origPartName = "";
|
|
8
|
+
export let pLink;
|
|
9
|
+
let subInsts = [];
|
|
10
|
+
$:
|
|
11
|
+
subInsts = Object.keys(subD);
|
|
12
|
+
async function goToUrl(subInstName) {
|
|
13
|
+
const subObj = subD[subInstName];
|
|
14
|
+
updateStore(subObj.partName, paramListToVal(subObj.dparam), true);
|
|
15
|
+
const rUrl = `${base}${pLink[subObj.partName]}`;
|
|
16
|
+
goto(rUrl);
|
|
17
|
+
}
|
|
18
|
+
function dwnParams2(subInstName) {
|
|
19
|
+
const iPartName = subD[subInstName].partName;
|
|
20
|
+
const idparams = subD[subInstName].dparam;
|
|
21
|
+
const aComment = `sub-design parameters of ${iPartName} from ${origPartName}`;
|
|
22
|
+
downloadParams(iPartName, paramListToVal(idparams), aComment);
|
|
23
|
+
}
|
|
24
|
+
function printOrientation(vec) {
|
|
25
|
+
let rStr = "[ ";
|
|
26
|
+
rStr += `${ffix(radToDeg(vec[0]))}, `;
|
|
27
|
+
rStr += `${ffix(radToDeg(vec[1]))}, `;
|
|
28
|
+
rStr += `${ffix(radToDeg(vec[2]))} ]`;
|
|
29
|
+
return rStr;
|
|
30
|
+
}
|
|
31
|
+
function printPosition(vec) {
|
|
32
|
+
let rStr = "[ ";
|
|
33
|
+
rStr += `${ffix(vec[0])}, `;
|
|
34
|
+
rStr += `${ffix(vec[1])}, `;
|
|
35
|
+
rStr += `${ffix(vec[2])} ]`;
|
|
36
|
+
return rStr;
|
|
37
|
+
}
|
|
38
|
+
function printSet(changed) {
|
|
39
|
+
const rStr = changed ? "Yes" : "";
|
|
40
|
+
return rStr;
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<section>
|
|
45
|
+
<h2>
|
|
46
|
+
Sub-designs
|
|
47
|
+
<span>(Number of sub-instances: {subInsts.length})</span>
|
|
48
|
+
</h2>
|
|
49
|
+
<ol>
|
|
50
|
+
{#each subInsts as subInst}
|
|
51
|
+
<li>
|
|
52
|
+
<input type="checkbox" id="cb_{subInst}" class="toggle" checked={false} />
|
|
53
|
+
<label for="cb_{subInst}" class="label">
|
|
54
|
+
<div class="arrow" />
|
|
55
|
+
{subInst}
|
|
56
|
+
</label>
|
|
57
|
+
<button on:click={() => goToUrl(subInst)}
|
|
58
|
+
>Go to {pLink[subD[subInst].partName]}</button
|
|
59
|
+
>
|
|
60
|
+
<button on:click={() => dwnParams2(subInst)}>Export parameters</button>
|
|
61
|
+
<div class="nested">
|
|
62
|
+
<article>
|
|
63
|
+
{Object.keys(subD[subInst].dparam).length} parameters of
|
|
64
|
+
<strong>{subD[subInst].partName}</strong>
|
|
65
|
+
with orientation {printOrientation(subD[subInst].orientation)} (degree) at position
|
|
66
|
+
{printPosition(subD[subInst].position)} (mm)
|
|
67
|
+
</article>
|
|
68
|
+
<table>
|
|
69
|
+
<thead>
|
|
70
|
+
<tr>
|
|
71
|
+
<td>Num</td>
|
|
72
|
+
<td>Name</td>
|
|
73
|
+
<td>Value</td>
|
|
74
|
+
<td>Init</td>
|
|
75
|
+
<td>Set?</td>
|
|
76
|
+
</tr>
|
|
77
|
+
</thead>
|
|
78
|
+
<tbody>
|
|
79
|
+
{#each Object.keys(subD[subInst].dparam) as param, pIdx}
|
|
80
|
+
<tr class:changed={subD[subInst].dparam[param].chg}>
|
|
81
|
+
<td>{pIdx + 1}</td>
|
|
82
|
+
<td>{param}</td>
|
|
83
|
+
<td>{subD[subInst].dparam[param].val}</td>
|
|
84
|
+
<td><i>{subD[subInst].dparam[param].init}</i></td>
|
|
85
|
+
<td><i>{printSet(subD[subInst].dparam[param].chg)}</i></td>
|
|
86
|
+
</tr>
|
|
87
|
+
{/each}
|
|
88
|
+
</tbody>
|
|
89
|
+
</table>
|
|
90
|
+
</div>
|
|
91
|
+
</li>
|
|
92
|
+
{/each}
|
|
93
|
+
</ol>
|
|
94
|
+
</section>
|
|
95
|
+
|
|
96
|
+
<style>/*
|
|
97
|
+
$canvas-point: grey;
|
|
98
|
+
|
|
99
|
+
// export to js
|
|
100
|
+
:export {
|
|
101
|
+
colorCanvasPoint: $canvas-point;
|
|
102
|
+
}
|
|
103
|
+
*/
|
|
104
|
+
section {
|
|
105
|
+
margin-left: 0.25rem;
|
|
106
|
+
margin-right: 1rem;
|
|
107
|
+
border-radius: 0.5rem;
|
|
108
|
+
background-color: LightGrey;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
section > h2 {
|
|
112
|
+
color: grey;
|
|
113
|
+
margin: 1rem 0.5rem 0;
|
|
114
|
+
margin-left: 0.25rem;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
section > h2 > span {
|
|
118
|
+
color: white;
|
|
119
|
+
font-size: 1rem;
|
|
120
|
+
font-weight: 400;
|
|
121
|
+
margin-left: 1rem;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
section > ol > li {
|
|
125
|
+
color: black;
|
|
126
|
+
font-size: 1rem;
|
|
127
|
+
font-weight: 400;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
section > ol > li > button {
|
|
131
|
+
/*display: inline-block;*/
|
|
132
|
+
height: 1.6rem;
|
|
133
|
+
/*width: 1.6rem;*/
|
|
134
|
+
color: darkBlue;
|
|
135
|
+
font-size: 0.8rem;
|
|
136
|
+
font-weight: 400;
|
|
137
|
+
padding: 0.2rem 0.4rem 0.2rem;
|
|
138
|
+
border-style: solid;
|
|
139
|
+
border-width: 0.1rem;
|
|
140
|
+
border-radius: 0.2rem;
|
|
141
|
+
border-color: darkBlue;
|
|
142
|
+
margin: 0.5rem;
|
|
143
|
+
background-color: lightBlue;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
input.toggle {
|
|
147
|
+
display: none;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
div.nested {
|
|
151
|
+
/*
|
|
152
|
+
margin: 0;
|
|
153
|
+
padding: 0;
|
|
154
|
+
padding-left: 2rem;
|
|
155
|
+
*/
|
|
156
|
+
padding-left: 1rem;
|
|
157
|
+
display: none;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
input.toggle:checked ~ div.nested {
|
|
161
|
+
display: block;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
div.arrow {
|
|
165
|
+
display: inline-block;
|
|
166
|
+
width: 0;
|
|
167
|
+
height: 0;
|
|
168
|
+
border-top: 0.4rem solid transparent;
|
|
169
|
+
border-bottom: 0.4rem solid transparent;
|
|
170
|
+
border-left: 0.72rem solid DarkOrange;
|
|
171
|
+
margin-left: 0.5rem;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
input.toggle:checked ~ label > div.arrow {
|
|
175
|
+
border-left: 0.4rem solid transparent;
|
|
176
|
+
border-right: 0.4rem solid transparent;
|
|
177
|
+
border-top: 0.72rem solid DarkOrange;
|
|
178
|
+
border-bottom: 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
div > article {
|
|
182
|
+
margin: 0.5rem;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
div > table {
|
|
186
|
+
font-size: 0.8rem;
|
|
187
|
+
font-weight: 400;
|
|
188
|
+
padding-bottom: 1rem;
|
|
189
|
+
margin-left: 1rem;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
div > table > thead {
|
|
193
|
+
background-color: #ddd;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
div > table > tbody {
|
|
197
|
+
background-color: #eee;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
div > table > tbody > tr.changed {
|
|
201
|
+
background-color: #ded;
|
|
202
|
+
}</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { tSubDesign, tAllLink } from 'geometrix';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
subD?: tSubDesign | undefined;
|
|
6
|
+
origPartName?: string | undefined;
|
|
7
|
+
pLink: tAllLink;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type SubDesignProps = typeof __propDef.props;
|
|
15
|
+
export type SubDesignEvents = typeof __propDef.events;
|
|
16
|
+
export type SubDesignSlots = typeof __propDef.slots;
|
|
17
|
+
export default class SubDesign extends SvelteComponent<SubDesignProps, SubDesignEvents, SubDesignSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script>import { onDestroy } from "svelte";
|
|
2
|
+
export let tMax = 10;
|
|
3
|
+
export let tStep = 0.1;
|
|
4
|
+
export let tUpdate = 500;
|
|
5
|
+
export let simTime = 0;
|
|
6
|
+
let intervalID = null;
|
|
7
|
+
let speed = 0;
|
|
8
|
+
let inc;
|
|
9
|
+
const speedMax = 4;
|
|
10
|
+
function clearInterval2() {
|
|
11
|
+
if (intervalID !== null) {
|
|
12
|
+
clearInterval(intervalID);
|
|
13
|
+
intervalID = null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function simRoutine() {
|
|
17
|
+
if (inc < 0 && simTime <= 0) {
|
|
18
|
+
simTime = tMax;
|
|
19
|
+
} else if (inc > 0 && simTime >= tMax) {
|
|
20
|
+
simTime = 0;
|
|
21
|
+
} else {
|
|
22
|
+
simTime += inc;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function setInterval2() {
|
|
26
|
+
const delay = tUpdate / 2 ** (Math.abs(speed) - 1);
|
|
27
|
+
inc = speed < 0 ? -tStep : tStep;
|
|
28
|
+
intervalID = setInterval(simRoutine, delay);
|
|
29
|
+
}
|
|
30
|
+
function simZero() {
|
|
31
|
+
clearInterval2();
|
|
32
|
+
simTime = 0;
|
|
33
|
+
speed = 0;
|
|
34
|
+
}
|
|
35
|
+
function simDecrem() {
|
|
36
|
+
clearInterval2();
|
|
37
|
+
speed = 0;
|
|
38
|
+
inc = -tStep;
|
|
39
|
+
simRoutine();
|
|
40
|
+
}
|
|
41
|
+
function simIncrem() {
|
|
42
|
+
clearInterval2();
|
|
43
|
+
speed = 0;
|
|
44
|
+
inc = tStep;
|
|
45
|
+
simRoutine();
|
|
46
|
+
}
|
|
47
|
+
function simPlayBackward() {
|
|
48
|
+
clearInterval2();
|
|
49
|
+
speed = Math.max(speed - 1, -speedMax);
|
|
50
|
+
setInterval2();
|
|
51
|
+
}
|
|
52
|
+
function simPlayForward() {
|
|
53
|
+
clearInterval2();
|
|
54
|
+
speed = Math.min(speed + 1, speedMax);
|
|
55
|
+
setInterval2();
|
|
56
|
+
}
|
|
57
|
+
function simPause() {
|
|
58
|
+
clearInterval2();
|
|
59
|
+
speed = 0;
|
|
60
|
+
}
|
|
61
|
+
onDestroy(() => {
|
|
62
|
+
clearInterval2;
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<nav>
|
|
67
|
+
<button on:click={simZero}>0</button>
|
|
68
|
+
<button on:click={simPlayBackward}><-</button>
|
|
69
|
+
<button on:click={simDecrem}>|<</button>
|
|
70
|
+
<button on:click={simPause}>||</button>
|
|
71
|
+
<button on:click={simIncrem}>>|</button>
|
|
72
|
+
<button on:click={simPlayForward}>-></button>
|
|
73
|
+
<input type="range" bind:value={simTime} min="0" max={tMax} step={tStep} />
|
|
74
|
+
<input type="number" bind:value={simTime} min="0" max={tMax} step={tStep} />
|
|
75
|
+
</nav>
|
|
76
|
+
|
|
77
|
+
<style>/*
|
|
78
|
+
$canvas-point: grey;
|
|
79
|
+
|
|
80
|
+
// export to js
|
|
81
|
+
:export {
|
|
82
|
+
colorCanvasPoint: $canvas-point;
|
|
83
|
+
}
|
|
84
|
+
*/
|
|
85
|
+
nav > button {
|
|
86
|
+
height: 1.6rem;
|
|
87
|
+
width: 1.6rem;
|
|
88
|
+
color: darkBlue;
|
|
89
|
+
font-size: 1.1rem;
|
|
90
|
+
font-weight: 900;
|
|
91
|
+
border-style: solid;
|
|
92
|
+
border-width: 0.1rem;
|
|
93
|
+
border-radius: 0.2rem;
|
|
94
|
+
border-color: darkBlue;
|
|
95
|
+
margin: 0;
|
|
96
|
+
background-color: lightBlue;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
nav > input[type=range] {
|
|
100
|
+
width: 8rem;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
nav > input[type=number] {
|
|
104
|
+
width: 3rem;
|
|
105
|
+
border-color: darkBlue;
|
|
106
|
+
background-color: lightBlue;
|
|
107
|
+
}</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
tMax?: number | undefined;
|
|
5
|
+
tStep?: number | undefined;
|
|
6
|
+
tUpdate?: number | undefined;
|
|
7
|
+
simTime?: number | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type TimeControlProps = typeof __propDef.props;
|
|
15
|
+
export type TimeControlEvents = typeof __propDef.events;
|
|
16
|
+
export type TimeControlSlots = typeof __propDef.slots;
|
|
17
|
+
export default class TimeControl extends SvelteComponent<TimeControlProps, TimeControlEvents, TimeControlSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|