geomui 0.5.52 → 0.5.56

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.
Files changed (40) hide show
  1. package/dist/Drawing.svelte +275 -262
  2. package/dist/Drawing.svelte.d.ts +8 -24
  3. package/dist/DrawingList.svelte +38 -33
  4. package/dist/DrawingList.svelte.d.ts +5 -18
  5. package/dist/InputParams.svelte +338 -283
  6. package/dist/InputParams.svelte.d.ts +7 -25
  7. package/dist/LabelCheckbox.svelte +12 -11
  8. package/dist/LabelCheckbox.svelte.d.ts +16 -14
  9. package/dist/LocStorRead.svelte +29 -17
  10. package/dist/LocStorRead.svelte.d.ts +6 -19
  11. package/dist/LocStorTable.svelte +88 -68
  12. package/dist/LocStorTable.svelte.d.ts +7 -20
  13. package/dist/LocStorWrite.svelte +28 -22
  14. package/dist/LocStorWrite.svelte.d.ts +6 -19
  15. package/dist/ModalDiag.svelte +33 -15
  16. package/dist/ModalDiag.svelte.d.ts +10 -22
  17. package/dist/ModalImg.svelte +11 -6
  18. package/dist/ModalImg.svelte.d.ts +6 -19
  19. package/dist/OneDesign.svelte +15 -6
  20. package/dist/OneDesign.svelte.d.ts +6 -19
  21. package/dist/ParamDrawExport.svelte +220 -134
  22. package/dist/ParamDrawExport.svelte.d.ts +7 -20
  23. package/dist/SimpleDrawing.svelte +82 -49
  24. package/dist/SimpleDrawing.svelte.d.ts +7 -23
  25. package/dist/SubDesign.svelte +64 -45
  26. package/dist/SubDesign.svelte.d.ts +8 -21
  27. package/dist/TimeControl.svelte +84 -69
  28. package/dist/TimeControl.svelte.d.ts +8 -21
  29. package/dist/ZoomControl.svelte +21 -14
  30. package/dist/ZoomControl.svelte.d.ts +5 -18
  31. package/dist/initStore.js +12 -11
  32. package/dist/stateDrawing.svelte.d.ts +8 -0
  33. package/dist/stateDrawing.svelte.js +8 -0
  34. package/dist/stateParams.svelte.d.ts +5 -0
  35. package/dist/stateParams.svelte.js +3 -0
  36. package/package.json +21 -21
  37. package/dist/drawingLayers.d.ts +0 -2
  38. package/dist/drawingLayers.js +0 -6
  39. package/dist/storePVal.d.ts +0 -5
  40. package/dist/storePVal.js +0 -4
@@ -1,20 +1,7 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { tPageDef, tAllLink } from 'geometrix';
3
- declare const __propDef: {
4
- props: {
5
- pageDef: tPageDef;
6
- pLink: tAllLink;
7
- };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {};
12
- exports?: {} | undefined;
13
- bindings?: string | undefined;
14
- };
15
- export type OneDesignProps = typeof __propDef.props;
16
- export type OneDesignEvents = typeof __propDef.events;
17
- export type OneDesignSlots = typeof __propDef.slots;
18
- export default class OneDesign extends SvelteComponent<OneDesignProps, OneDesignEvents, OneDesignSlots> {
19
- }
20
- export {};
2
+ declare const OneDesign: import("svelte").Component<{
3
+ pageDef: tPageDef;
4
+ pLink: tAllLink;
5
+ }, {}, "">;
6
+ type OneDesign = ReturnType<typeof OneDesign>;
7
+ export default OneDesign;
@@ -1,148 +1,218 @@
1
- <script>import {
2
- EFormat,
3
- fileBinContent,
4
- fileTextContent,
5
- fileSuffix,
6
- fileMime,
7
- fileBin,
8
- adjustZero
9
- } from "geometrix";
10
- import InputParams from "./InputParams.svelte";
11
- import Drawing from "./Drawing.svelte";
12
- import SubDesign from "./SubDesign.svelte";
13
- import { storePV } from "./storePVal";
14
- export let pDef;
15
- export let fgeom;
16
- export let pLink;
17
- function checkWarn(txt) {
18
- let rWarn = true;
19
- const re = /warn/i;
20
- if (txt.search(re) < 0) {
21
- rWarn = false;
22
- }
23
- return rWarn;
24
- }
25
- let optFaces = [];
26
- let exportFace;
27
- let selFace;
28
- let simTime = 0;
29
- let zAdjust = adjustZero();
30
- let logValue = "Dummy initial\nWill be replaced during onMount\n";
31
- let calcErr = false;
32
- let calcWarn = false;
33
- let subD = {};
34
- function paramChange2(iPageName, iSimTime) {
35
- const mydate = (/* @__PURE__ */ new Date()).toLocaleTimeString();
36
- logValue = `Geometry ${iPageName} computed at ${mydate}
37
- `;
38
- const geome = fgeom(iSimTime, $storePV[pDef.partName]);
39
- logValue += geome.logstr;
40
- calcErr = geome.calcErr;
41
- calcWarn = checkWarn(geome.logstr);
42
- optFaces = Object.keys(geome.fig);
43
- exportFace = "zip";
44
- subD = geome.sub;
45
- }
46
- function paramChange() {
47
- paramChange2(pDef.partName, simTime);
48
- }
49
- $: paramChange2(pDef.partName, simTime);
50
- function download_binFile(fName, fContent) {
51
- const elem_a_download = document.createElement("a");
52
- const payload = URL.createObjectURL(fContent);
53
- elem_a_download.setAttribute("href", payload);
54
- elem_a_download.setAttribute("download", fName);
55
- elem_a_download.click();
56
- elem_a_download.remove();
57
- URL.revokeObjectURL(payload);
58
- }
59
- function download_textFile(fName, fContent, fMime) {
60
- const elem_a_download = document.createElement("a");
61
- const payload = "data:" + fMime + ";utf-8," + encodeURIComponent(fContent);
62
- elem_a_download.setAttribute("href", payload);
63
- elem_a_download.setAttribute("download", fName);
64
- elem_a_download.click();
65
- elem_a_download.remove();
66
- }
67
- function dateString() {
68
- const re1 = /[-:]/g;
69
- const re2 = /\..*$/;
70
- const rDateStr = (/* @__PURE__ */ new Date()).toISOString().replace(re1, "").replace(re2, "").replace("T", "_");
71
- return rDateStr;
72
- }
73
- async function downloadExport(iExportFace) {
74
- const reSvg = /^svg_/;
75
- const reDxf = /^dxf_/;
76
- let exportFormat = EFormat.eSVG;
77
- let nFace = "all";
78
- if (iExportFace.match(reSvg)) {
79
- exportFormat = EFormat.eSVG;
80
- nFace = iExportFace.replace(reSvg, "");
81
- } else if (iExportFace.match(reDxf)) {
82
- exportFormat = EFormat.eDXF;
83
- nFace = iExportFace.replace(reDxf, "");
84
- } else if (iExportFace === "allsvg") {
85
- exportFormat = EFormat.eSVGALL;
86
- } else if (iExportFace === "alldxf") {
87
- exportFormat = EFormat.eDXFALL;
88
- } else if (iExportFace === "compute_log") {
89
- exportFormat = EFormat.eTXTLOG;
90
- } else if (iExportFace === "pax") {
91
- exportFormat = EFormat.ePAX;
92
- } else if (iExportFace === "oscad") {
93
- exportFormat = EFormat.eOPENSCAD;
94
- } else if (iExportFace === "ojscad") {
95
- exportFormat = EFormat.eJSCAD;
96
- } else if (iExportFace === "freecad") {
97
- exportFormat = EFormat.eFREECAD;
98
- } else if (iExportFace === "zip") {
99
- exportFormat = EFormat.eZIP;
100
- } else {
101
- console.log(`err883: downloadExport iExportFace ${iExportFace} invalid`);
102
- }
103
- const fSuffix = fileSuffix(exportFormat);
104
- const fMime = fileMime(exportFormat);
105
- const fBin = fileBin(exportFormat);
106
- const fName = pDef.partName + "_" + nFace + "_" + dateString() + fSuffix;
107
- if (fBin) {
108
- const fContent = await fileBinContent(
109
- fgeom,
110
- simTime,
111
- $storePV[pDef.partName],
112
- pDef,
113
- exportFormat
114
- );
115
- download_binFile(fName, fContent);
116
- } else {
117
- const fContent = fileTextContent(
118
- fgeom,
119
- $storePV[pDef.partName],
120
- pDef,
121
- nFace,
122
- exportFormat
123
- );
124
- download_textFile(fName, fContent, fMime);
125
- }
126
- }
127
- async function downloadExport2() {
128
- await downloadExport(exportFace);
129
- }
1
+ <script lang="ts">
2
+ import type {
3
+ tParamDef,
4
+ tGeomFunc,
5
+ tSubDesign,
6
+ tAllLink,
7
+ tFigures,
8
+ Figure,
9
+ tGeom
10
+ } from 'geometrix';
11
+ import {
12
+ EFormat,
13
+ fileBinContent,
14
+ fileTextContent,
15
+ fileSuffix,
16
+ fileMime,
17
+ fileBin,
18
+ mergeFaces
19
+ } from 'geometrix';
20
+ import InputParams from './InputParams.svelte';
21
+ import Drawing from './Drawing.svelte';
22
+ import SubDesign from './SubDesign.svelte';
23
+ import { sParams } from './stateParams.svelte';
24
+
25
+ // properties
26
+ interface Props {
27
+ pDef: tParamDef;
28
+ fgeom: tGeomFunc;
29
+ pLink: tAllLink;
30
+ }
31
+ let { pDef, fgeom, pLink }: Props = $props();
32
+
33
+ // const
34
+ const c_ParametrixAll = 'ParametrixAll';
35
+
36
+ // helper function
37
+ function checkWarn(txt: string) {
38
+ let rWarn = true;
39
+ const re = /warn/i;
40
+ if (txt.search(re) < 0) {
41
+ rWarn = false;
42
+ }
43
+ return rWarn;
44
+ }
45
+ // create pFig
46
+ function checkFace(iFaces: string[], iFace: string): string {
47
+ let rFace = iFace;
48
+ if (iFaces.length === 0) {
49
+ console.log(`warn404: Drawing has an empty face list`);
50
+ } else {
51
+ //rFace = iFaces[0];
52
+ const FaceList2 = iFaces.slice();
53
+ FaceList2.push(c_ParametrixAll);
54
+ if (!FaceList2.includes(rFace)) {
55
+ //console.log(`warn403: Drawing has an invalid face ${rFace}`);
56
+ rFace = iFaces[0];
57
+ }
58
+ }
59
+ //console.log(iFaces);
60
+ //console.log(`dbg097: rFace ${rFace}`);
61
+ return rFace;
62
+ }
63
+ function selectFig(iFigures: tFigures, iFace: string) {
64
+ let rFig: Figure;
65
+ const FigListKeys = Object.keys(iFigures);
66
+ const sFace = checkFace(FigListKeys, iFace);
67
+ if (FigListKeys.includes(sFace)) {
68
+ rFig = iFigures[sFace];
69
+ } else {
70
+ rFig = mergeFaces(iFigures);
71
+ }
72
+ return rFig;
73
+ }
74
+
75
+ // state
76
+ let simTime: number = $state(0);
77
+ let selFace: string = $state(checkFace(Object.keys(fgeom(0, sParams[pDef.partName]).fig), ''));
78
+ // internal state that should not need state
79
+ let exportFace: string = $state('zip'); // TODO5 keep state otherwise svelte complains
80
+
81
+ // derived
82
+ let geome: tGeom = $derived(fgeom(simTime, sParams[pDef.partName]));
83
+ let logValue: string = $derived.by(() => {
84
+ const mydate = new Date().toLocaleTimeString();
85
+ let rLogValue = `Geometry ${pDef.partName} computed at ${mydate}\n`;
86
+ rLogValue += geome.logstr;
87
+ return rLogValue;
88
+ });
89
+ let optFaces: string[] = $derived(Object.keys(geome.fig));
90
+ let calcErr: boolean = $derived(geome.calcErr);
91
+ let calcWarn: boolean = $derived(checkWarn(geome.logstr));
92
+ let pFig: Figure = $derived(selectFig(geome.fig, selFace));
93
+ let subD: tSubDesign = $derived(geome.sub);
94
+
95
+ // actions: export drawings
96
+ function download_binFile(fName: string, fContent: Blob) {
97
+ //create temporary an invisible element
98
+ const elem_a_download = document.createElement('a');
99
+ //const payload = 'data:' + fMime + ';base64,' + fContent;
100
+ const payload = URL.createObjectURL(fContent);
101
+ elem_a_download.setAttribute('href', payload);
102
+ elem_a_download.setAttribute('download', fName);
103
+ //document.body.appendChild(elem_a_download); // it does not seem required to append the element to the DOM to use it
104
+ elem_a_download.click();
105
+ //document.body.removeChild(elem_a_download);
106
+ elem_a_download.remove(); // Is this really required?
107
+ URL.revokeObjectURL(payload);
108
+ }
109
+ function download_textFile(fName: string, fContent: string, fMime: string) {
110
+ //create temporary an invisible element
111
+ const elem_a_download = document.createElement('a');
112
+ const payload = 'data:' + fMime + ';utf-8,' + encodeURIComponent(fContent);
113
+ elem_a_download.setAttribute('href', payload);
114
+ elem_a_download.setAttribute('download', fName);
115
+ //document.body.appendChild(elem_a_download); // it does not seem required to append the element to the DOM to use it
116
+ elem_a_download.click();
117
+ //document.body.removeChild(elem_a_download);
118
+ elem_a_download.remove(); // Is this really required?
119
+ }
120
+ function dateString(): string {
121
+ const re1 = /[-:]/g;
122
+ const re2 = /\..*$/;
123
+ const rDateStr = new Date()
124
+ .toISOString()
125
+ .replace(re1, '')
126
+ .replace(re2, '')
127
+ .replace('T', '_');
128
+ return rDateStr;
129
+ }
130
+ async function downloadExport(iExportFace: string) {
131
+ //console.log(`dbg883: iExportFace ${iExportFace}`);
132
+ const reSvg = /^svg_/;
133
+ const reDxf = /^dxf_/;
134
+ let exportFormat = EFormat.eSVG;
135
+ let nFace = 'all';
136
+ if (iExportFace.match(reSvg)) {
137
+ exportFormat = EFormat.eSVG;
138
+ nFace = iExportFace.replace(reSvg, '');
139
+ } else if (iExportFace.match(reDxf)) {
140
+ exportFormat = EFormat.eDXF;
141
+ nFace = iExportFace.replace(reDxf, '');
142
+ } else if (iExportFace === 'allsvg') {
143
+ exportFormat = EFormat.eSVGALL;
144
+ } else if (iExportFace === 'alldxf') {
145
+ exportFormat = EFormat.eDXFALL;
146
+ } else if (iExportFace === 'compute_log') {
147
+ exportFormat = EFormat.eTXTLOG;
148
+ } else if (iExportFace === 'pax') {
149
+ exportFormat = EFormat.ePAX;
150
+ } else if (iExportFace === 'oscad') {
151
+ exportFormat = EFormat.eOPENSCAD;
152
+ } else if (iExportFace === 'ojscad') {
153
+ exportFormat = EFormat.eJSCAD;
154
+ } else if (iExportFace === 'freecad') {
155
+ exportFormat = EFormat.eFREECAD;
156
+ } else if (iExportFace === 'zip') {
157
+ exportFormat = EFormat.eZIP;
158
+ } else {
159
+ console.log(`err883: downloadExport iExportFace ${iExportFace} invalid`);
160
+ }
161
+ //console.log(`exportFormat ${exportFormat}`);
162
+ const fSuffix = fileSuffix(exportFormat);
163
+ const fMime = fileMime(exportFormat);
164
+ const fBin = fileBin(exportFormat);
165
+ const fName = pDef.partName + '_' + nFace + '_' + dateString() + fSuffix;
166
+ if (fBin) {
167
+ const fContent = await fileBinContent(
168
+ fgeom,
169
+ simTime,
170
+ sParams[pDef.partName],
171
+ pDef,
172
+ exportFormat
173
+ );
174
+ download_binFile(fName, fContent);
175
+ } else {
176
+ const fContent = fileTextContent(
177
+ fgeom,
178
+ sParams[pDef.partName],
179
+ pDef,
180
+ nFace,
181
+ exportFormat
182
+ );
183
+ download_textFile(fName, fContent, fMime);
184
+ }
185
+ }
186
+ async function downloadExport2() {
187
+ await downloadExport(exportFace);
188
+ }
130
189
  </script>
131
190
 
132
- <InputParams {pDef} on:paramChg={paramChange} {fgeom} {selFace} {zAdjust} {simTime} />
191
+ <InputParams {pDef} {pFig} />
133
192
  <section>
134
193
  <h2>Log</h2>
135
194
  <textarea
136
195
  rows="5"
137
196
  cols="94"
138
197
  readonly
139
- wrap="off"
198
+ wrap="soft"
140
199
  value={logValue}
141
200
  class:colorErr={calcErr}
142
201
  class:colorWarn={calcWarn}
143
- />
202
+ ></textarea>
203
+ </section>
204
+ <section>
205
+ <h2>
206
+ Drawing
207
+ <select bind:value={selFace}>
208
+ {#each optFaces as optFace}
209
+ <option value={optFace}>{optFace}</option>
210
+ {/each}
211
+ <option value={c_ParametrixAll}>All faces merged</option>
212
+ </select>
213
+ </h2>
144
214
  </section>
145
- <Drawing {pDef} {fgeom} {optFaces} bind:selFace bind:zAdjust bind:simTime />
215
+ <Drawing pDefSim={pDef.sim} {pFig} bind:simTime />
146
216
  <section>
147
217
  <h2>Export</h2>
148
218
  <select bind:value={exportFace}>
@@ -161,7 +231,7 @@ async function downloadExport2() {
161
231
  <option value="freecad">all faces as Freecad.py</option>
162
232
  <option value="zip">all faces and more as zip</option>
163
233
  </select>
164
- <button on:click={downloadExport2}>Save to File</button>
234
+ <button onclick={downloadExport2}>Save to File</button>
165
235
  <SubDesign {subD} origPartName={pDef.partName} {pLink} />
166
236
  </section>
167
237
 
@@ -178,6 +248,22 @@ section > h2 {
178
248
  margin: 1rem 0.5rem 0;
179
249
  }
180
250
 
251
+ section > h2 > select {
252
+ /*display: inline-block;*/
253
+ height: 1.6rem;
254
+ /*width: 1.6rem;*/
255
+ color: darkBlue;
256
+ font-size: 0.8rem;
257
+ font-weight: 400;
258
+ padding: 0.2rem 0.4rem 0.2rem;
259
+ border-style: solid;
260
+ border-width: 0.1rem;
261
+ border-radius: 0.2rem;
262
+ border-color: darkBlue;
263
+ margin: 0.5rem;
264
+ background-color: lightBlue;
265
+ }
266
+
181
267
  section > textarea {
182
268
  /*resize: horizontal;*/
183
269
  margin-left: 0.5rem;
@@ -1,21 +1,8 @@
1
- import { SvelteComponent } from "svelte";
2
1
  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
- exports?: {} | undefined;
14
- bindings?: string | undefined;
15
- };
16
- export type ParamDrawExportProps = typeof __propDef.props;
17
- export type ParamDrawExportEvents = typeof __propDef.events;
18
- export type ParamDrawExportSlots = typeof __propDef.slots;
19
- export default class ParamDrawExport extends SvelteComponent<ParamDrawExportProps, ParamDrawExportEvents, ParamDrawExportSlots> {
20
- }
21
- export {};
2
+ declare const ParamDrawExport: import("svelte").Component<{
3
+ pDef: tParamDef;
4
+ fgeom: tGeomFunc;
5
+ pLink: tAllLink;
6
+ }, {}, "">;
7
+ type ParamDrawExport = ReturnType<typeof ParamDrawExport>;
8
+ export default ParamDrawExport;
@@ -1,54 +1,87 @@
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 zAdjust;
9
- export let simTime = 0;
10
- let canvasMini;
11
- const canvas_size_mini = 200;
12
- let mAdjust;
13
- function canvasRedrawMini(aFigure, iLayers) {
14
- const sLayers = copyLayers(iLayers);
15
- sLayers.ruler = false;
16
- const ctx1 = canvasMini.getContext("2d");
17
- ctx1.clearRect(0, 0, ctx1.canvas.width, ctx1.canvas.height);
18
- try {
19
- if (zAdjust.init === 0) {
20
- mAdjust = aFigure.getAdjustFull(ctx1.canvas.width, ctx1.canvas.height);
21
- } else {
22
- mAdjust = zAdjust;
23
- }
24
- aFigure.draw(ctx1, mAdjust, sLayers);
25
- } catch (emsg) {
26
- console.log(emsg);
27
- }
28
- }
29
- let domInit = 0;
30
- function geomRedraw(iSimTime, ipVal, iFace, iLayers) {
31
- const FigList = fgeom(iSimTime, ipVal).fig;
32
- if (Object.keys(FigList).includes(iFace)) {
33
- const aFigure = FigList[iFace];
34
- canvasRedrawMini(aFigure, iLayers);
35
- } else {
36
- const aFigure = mergeFaces(FigList);
37
- canvasRedrawMini(aFigure, iLayers);
38
- }
39
- }
40
- onMount(() => {
41
- geomRedraw(simTime, $storePV[pageName], selFace, $dLayers);
42
- domInit = 1;
43
- });
44
- $: {
45
- if (domInit === 1) {
46
- geomRedraw(simTime, $storePV[pageName], selFace, $dLayers);
47
- }
48
- }
1
+ <script lang="ts">
2
+ import type { tCanvasAdjust, tLayers, Figure } from 'geometrix';
3
+ import { adjustMini, copyLayers } from 'geometrix';
4
+ import { sDraw } from './stateDrawing.svelte';
5
+
6
+ // props
7
+ interface Props {
8
+ pFig: Figure;
9
+ full: boolean;
10
+ }
11
+ let { pFig, full }: Props = $props();
12
+
13
+ // const
14
+ const canvas_size_mini = 200;
15
+ const scaleFactor = 0.6;
16
+
17
+ // internal state: no need of reactivity with $state()
18
+ let canvasMini: HTMLCanvasElement;
19
+
20
+ // Canavas Figures
21
+ function canvasRedrawMini(
22
+ aFigure: Figure,
23
+ iZAdjust: tCanvasAdjust,
24
+ iCZwidth: number,
25
+ iLayers: tLayers
26
+ ) {
27
+ const sLayers = copyLayers(iLayers);
28
+ sLayers.ruler = false;
29
+ let mAdjust: tCanvasAdjust;
30
+ if (canvasMini) {
31
+ const ctx1 = canvasMini.getContext('2d')!;
32
+ ctx1.clearRect(0, 0, ctx1.canvas.width, ctx1.canvas.height);
33
+ const c1w = ctx1.canvas.width;
34
+ try {
35
+ if (full) {
36
+ // mini-full with zAdjust set to adjustZero()
37
+ mAdjust = aFigure.getAdjustFull(ctx1.canvas.width, ctx1.canvas.height);
38
+ } else {
39
+ mAdjust = adjustMini(iCZwidth, c1w, iZAdjust);
40
+ }
41
+ aFigure.draw(ctx1, mAdjust, sLayers);
42
+ } catch (emsg) {
43
+ //rGeome.logstr += emsg;
44
+ console.log(emsg);
45
+ }
46
+ // extra drawing
47
+ //point(5, 5).draw(ctx1, mAdjust, 'green');
48
+ //point(5, 15).draw(ctx1, mAdjust, 'blue', 'rectangle');
49
+ }
50
+ }
51
+ // reactivity
52
+ $effect(() => {
53
+ canvasRedrawMini(pFig, sDraw.zAdjust, sDraw.canvasZWidth, sDraw.dLayers);
54
+ });
55
+ // actions
56
+ function clickQuater(eve: MouseEvent) {
57
+ const mouseX = eve.offsetX;
58
+ const mouseY = eve.offsetY;
59
+ const ctx1 = canvasMini.getContext('2d')!;
60
+ const quaterX = ctx1.canvas.width / 2;
61
+ const quaterY = ctx1.canvas.height / 2;
62
+ if (eve.button === 0) {
63
+ // pressing the main button
64
+ let quaterID = 1;
65
+ if (mouseX > quaterX) {
66
+ quaterID += 1 * scaleFactor;
67
+ }
68
+ if (mouseY > quaterY) {
69
+ quaterID += 2 * scaleFactor;
70
+ }
71
+ ctx1.canvas.width = quaterID * canvas_size_mini;
72
+ ctx1.canvas.height = quaterID * canvas_size_mini;
73
+ canvasRedrawMini(pFig, sDraw.zAdjust, sDraw.canvasZWidth, sDraw.dLayers);
74
+ }
75
+ }
49
76
  </script>
50
77
 
51
- <canvas class="mini" width={canvas_size_mini} height={canvas_size_mini} bind:this={canvasMini} />
78
+ <canvas
79
+ class="mini"
80
+ width={canvas_size_mini}
81
+ height={canvas_size_mini}
82
+ bind:this={canvasMini}
83
+ onclick={clickQuater}
84
+ ></canvas>
52
85
 
53
86
  <style>/*
54
87
  $canvas-point: grey;
@@ -1,23 +1,7 @@
1
- import { SvelteComponent } from "svelte";
2
- import type { tCanvasAdjust, tGeomFunc } from 'geometrix';
3
- declare const __propDef: {
4
- props: {
5
- pageName: string;
6
- fgeom: tGeomFunc;
7
- selFace: string;
8
- zAdjust: tCanvasAdjust;
9
- simTime?: number;
10
- };
11
- events: {
12
- [evt: string]: CustomEvent<any>;
13
- };
14
- slots: {};
15
- exports?: {} | undefined;
16
- bindings?: string | undefined;
17
- };
18
- export type SimpleDrawingProps = typeof __propDef.props;
19
- export type SimpleDrawingEvents = typeof __propDef.events;
20
- export type SimpleDrawingSlots = typeof __propDef.slots;
21
- export default class SimpleDrawing extends SvelteComponent<SimpleDrawingProps, SimpleDrawingEvents, SimpleDrawingSlots> {
22
- }
23
- export {};
1
+ import type { Figure } from 'geometrix';
2
+ declare const SimpleDrawing: import("svelte").Component<{
3
+ pFig: Figure;
4
+ full: boolean;
5
+ }, {}, "">;
6
+ type SimpleDrawing = ReturnType<typeof SimpleDrawing>;
7
+ export default SimpleDrawing;