frame.image 1.3.4 → 1.3.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Designer.d.ts","sourceRoot":"","sources":["../src/Designer.tsx"],"names":[],"mappings":"AAaA,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,2CA6JA"}
1
+ {"version":3,"file":"Designer.d.ts","sourceRoot":"","sources":["../src/Designer.tsx"],"names":[],"mappings":"AAcA,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,2CAyOA"}
package/dist/Designer.js CHANGED
@@ -10,12 +10,14 @@ import { useState } from 'react';
10
10
  import { Polygon } from './Polygon';
11
11
  import { Point } from './Point';
12
12
  import { Finish } from './Finish';
13
+ import { Start } from './Start';
13
14
  export function Designer(props) {
14
15
  const nrPoints = props.nrPoints || 128;
15
16
  const width = 600;
16
17
  const height = 400;
17
18
  const universeCenter = new Point(width / 2, height / 2);
18
19
  const [currentMachine, sendCommand] = useMachine(machine);
20
+ const [scalingEnabled, setScalingEnabled] = useState(false);
19
21
  const [imageUrl, setDataUrl] = useState(undefined);
20
22
  const [axis, setAxis] = useState({});
21
23
  const [rotationAngle, setRotationAngle] = useState(0);
@@ -37,33 +39,6 @@ export function Designer(props) {
37
39
  vertical: 0,
38
40
  });
39
41
  const [catmullRomPoints, setCatmullRomPoints] = useState(undefined);
40
- const [SH, setSH] = useState(0);
41
- const [SL, setSL] = useState(0);
42
- const styleStates = {
43
- position: 'absolute',
44
- top: '50%',
45
- left: '50%',
46
- transform: 'translate(-50%, -50%)',
47
- width: 1000,
48
- height: 700,
49
- bgcolor: 'background.paper',
50
- border: '2px solid #000',
51
- boxShadow: 24,
52
- p: 4,
53
- };
54
- const styleCanvas = {
55
- position: 'absolute',
56
- top: '58%',
57
- left: '50%',
58
- transform: 'translate(-80%, -50%)',
59
- width,
60
- height,
61
- bgcolor: 'background.paper',
62
- border: '2px solid #000',
63
- boxShadow: 24,
64
- p: 4,
65
- padding: '2px',
66
- };
67
42
  const onClickReset = () => {
68
43
  setCoords(new Polygon([], universeCenter));
69
44
  // setCatmullRomPoints(undefined);
@@ -72,20 +47,40 @@ export function Designer(props) {
72
47
  setRotationAngle(0);
73
48
  sendCommand(ACTION.RESET);
74
49
  };
75
- function onCloseScaleForm(cont = true) {
50
+ const onAfterLoadImage = (url) => {
51
+ setDataUrl(url);
52
+ sendCommand(ACTION.LOAD_IMAGE);
53
+ };
54
+ const onAfterLoadPoints = (points, universeCenter) => {
55
+ setCoords(new Polygon(points, universeCenter));
56
+ sendCommand(ACTION.DEFINE_POINTS);
57
+ };
58
+ const onAfterDefinePoints = () => {
59
+ sendCommand(ACTION.DEFINE_POINTS);
60
+ };
61
+ function onCloseScaleForm() {
76
62
  // if (cont) {
77
63
  // props.command(ACTION.SCALE_FORM);
78
64
  // }
79
65
  // setShowModalScaleForm(false);
80
66
  }
81
67
  function handleCloseScaleFormCancel() {
82
- onCloseScaleForm(false);
68
+ onCloseScaleForm();
83
69
  }
84
70
  function handleCloseScaleFormContinue(length, height) {
85
71
  currentMachine.context.length = length;
86
72
  currentMachine.context.height = height;
87
- onCloseScaleForm(true);
73
+ onCloseScaleForm();
88
74
  }
75
+ const onLoad = (nrPts) => {
76
+ sendCommand(ACTION.RESET);
77
+ for (let i = 0; i < nrPts; i++) {
78
+ sendCommand(ACTION.DEFINE_POINTS);
79
+ }
80
+ };
81
+ const onTransform = () => {
82
+ setScalingEnabled(true);
83
+ };
89
84
  const onClose = (pol) => () => {
90
85
  const catmullRomPolygonRT1 = pol.createCatmullRomPoints(128);
91
86
  catmullRomPolygonRT1.assertEquiDistantAngles();
@@ -96,11 +91,54 @@ export function Designer(props) {
96
91
  console.log(`TR1: ${tr1}`);
97
92
  props.onClose(rt1);
98
93
  };
99
- return (_jsxs("div", { children: [_jsxs(Box, { id: "boxStates", sx: styleStates, display: "flex", flexDirection: "column", gap: 2, children: [_jsx(States, { machine: currentMachine, command: sendCommand, onClickReset: onClickReset, setDataUrl: setDataUrl, coords: { coords, setCoords } }), _jsx(ShowOptions, { show: show, setShow: setShow })] }), _jsxs(Box, { id: "boxCanvas", sx: {
100
- ...styleCanvas,
94
+ return (_jsxs("div", { id: "id.Designer", style: {
95
+ height: '100vh', // Use viewport height for reliable stacking
96
+ width: '100vw',
97
+ display: 'flex',
98
+ flexDirection: 'column',
99
+ }, children: [_jsxs(Box, { id: "id.box.States", sx: {
100
+ flex: '0 0 20%',
101
+ height: '20%',
102
+ minHeight: 0,
103
+ overflow: 'auto',
104
+ width: '100%',
105
+ }, children: [_jsx(States, { machine: currentMachine, command: sendCommand, onClickReset: onClickReset, setDataUrl: setDataUrl, coords: { coords, setCoords } }), _jsx(ShowOptions, { show: show, setShow: setShow })] }), _jsxs(Box, { id: "id.box.Draw", sx: {
106
+ flex: '1 1 80%',
107
+ height: '80%',
108
+ minHeight: 0,
101
109
  display: 'flex',
102
- flexDirection: 'row',
103
- alignItems: 'flex-start',
104
- gap: 2,
105
- }, children: [_jsx(DrawCanvas, { machine: currentMachine, command: sendCommand, width: width, height: height, status: { status, setStatus }, show: show, axis: { axis, setAxis }, imageUrl: imageUrl, coords: { coords, setCoords }, imageCoords: { imageCoords, setImageCoords }, rotation: { rotationAngle, setRotationAngle }, catmullRomPoints: { catmullRomPoints, setCatmullRomPoints } }), _jsx(ScaleForm, { title: "Apply Scale", currentPoints: currentMachine.context.nrPoints, onCloseCancel: handleCloseScaleFormCancel, onCloseContinue: handleCloseScaleFormContinue, sl: SL, sh: SH })] }), _jsx(Finish, { universeCenter: universeCenter, nrPoints: nrPoints, coords: { coords, setCoords }, onClose: onClose })] }));
110
+ flexDirection: 'column',
111
+ width: '100%',
112
+ position: 'relative',
113
+ }, children: [_jsxs(Box, { id: "id.box.1", sx: {
114
+ height: '80%',
115
+ maxHeight: '80%',
116
+ width: '100%',
117
+ display: 'flex',
118
+ flexDirection: 'row',
119
+ overflow: 'auto', // Scrollbar, wenn Inhalt zu groß
120
+ }, children: [_jsx(Box, { id: "id.box.Start", sx: {
121
+ width: '10%',
122
+ minWidth: 0,
123
+ display: 'flex',
124
+ flexDirection: 'column',
125
+ height: '100%',
126
+ }, children: _jsx(Start, { machine: currentMachine, onReset: onClickReset, onAfterLoadImage: onAfterLoadImage, onAfterLoadPoints: onAfterLoadPoints, onAfterDefinePoints: onAfterDefinePoints }) }), _jsx(Box, { id: "id.box.canvas", sx: {
127
+ width: '60%',
128
+ minWidth: 0,
129
+ flex: 1,
130
+ display: 'flex',
131
+ flexDirection: 'column',
132
+ height: '100%',
133
+ }, children: _jsx(DrawCanvas, { machine: currentMachine, command: sendCommand, width: width, height: height, status: { status, setStatus }, show: show, axis: { axis, setAxis }, imageUrl: imageUrl, coords: { coords, setCoords }, imageCoords: { imageCoords, setImageCoords }, rotation: { rotationAngle, setRotationAngle }, catmullRomPoints: { catmullRomPoints, setCatmullRomPoints } }) }), _jsx(Box, { id: "id.box.ScaleForm", sx: {
134
+ width: '30%',
135
+ minWidth: 0,
136
+ display: 'flex',
137
+ flexDirection: 'column',
138
+ height: '100%',
139
+ }, children: _jsx(ScaleForm, { title: "Apply Scale", currentPoints: currentMachine.context.nrPoints, coords: { coords, setCoords }, disabled: !scalingEnabled, onCloseCancel: handleCloseScaleFormCancel, onCloseContinue: handleCloseScaleFormContinue }) })] }), _jsx(Box, { id: "id.box.2", sx: {
140
+ height: '20%',
141
+ width: '100%',
142
+ overflow: 'auto',
143
+ }, children: _jsx(Finish, { universeCenter: universeCenter, nrPoints: nrPoints, coords: { coords, setCoords }, onLoad: onLoad, onTransform: onTransform, onClose: onClose }) })] })] }));
106
144
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DrawCanvas.d.ts","sourceRoot":"","sources":["../src/DrawCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqD,MAAM,OAAO,CAAC;AAG/E,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,UAAU,EACV,aAAa,EACb,KAAK,EACL,WAAW,EACZ,MAAM,SAAS,CAAC;AAIjB,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAChC,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CA+fd"}
1
+ {"version":3,"file":"DrawCanvas.d.ts","sourceRoot":"","sources":["../src/DrawCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqD,MAAM,OAAO,CAAC;AAG/E,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,UAAU,EACV,aAAa,EACb,KAAK,EACL,WAAW,EACZ,MAAM,SAAS,CAAC;AAIjB,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAChC,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAmgBd"}
@@ -184,10 +184,14 @@ export function DrawCanvas(props) {
184
184
  }, [drawImageBackground, drawDefaultBackground]);
185
185
  const getCurrentPoint = useCallback((canvas, event) => {
186
186
  const rect = canvas.getBoundingClientRect();
187
- const x = event.clientX - rect.left - universeCenter.X;
188
- const y = universeCenter.Y - (event.clientY - rect.top);
187
+ const scaleFactorX = props.width / rect.width;
188
+ const scaleFactorY = props.height / rect.height;
189
+ const centerX = rect.left + rect.width / 2;
190
+ const centerY = rect.top + rect.height / 2;
191
+ const x = (event.clientX - centerX) * scaleFactorX;
192
+ const y = (centerY - event.clientY) * scaleFactorY;
189
193
  return new Point(x, y, universeCenter);
190
- }, [universeCenter]);
194
+ }, [props.height, props.width, universeCenter]);
191
195
  // Event listener for mouse click
192
196
  const handleMouseClick = useCallback((event) => {
193
197
  event.preventDefault();
package/dist/Finish.d.ts CHANGED
@@ -5,6 +5,8 @@ export declare function Finish(props: {
5
5
  universeCenter: Point;
6
6
  nrPoints: number;
7
7
  coords: TCoordsHook;
8
+ onLoad: (nrPoints: number) => void;
9
+ onTransform: () => void;
8
10
  onClose: (pol: Polygon) => () => void;
9
11
  }): import("react/jsx-runtime").JSX.Element;
10
12
  //# sourceMappingURL=Finish.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Finish.d.ts","sourceRoot":"","sources":["../src/Finish.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,cAAc,EAAE,KAAK,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;CACvC,2CAmGA"}
1
+ {"version":3,"file":"Finish.d.ts","sourceRoot":"","sources":["../src/Finish.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,cAAc,EAAE,KAAK,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;CACvC,2CAkIA"}
package/dist/Finish.js CHANGED
@@ -1,12 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Button } from '@mui/material';
3
3
  import { useState } from 'react';
4
+ import { Polygon } from './Polygon';
4
5
  import { Point } from './Point';
5
6
  export function Finish(props) {
6
7
  const [originalCoords, setOriginalCoords] = useState(undefined);
7
8
  const styleButton = {
9
+ display: 'flex',
10
+ flexDirection: 'row',
11
+ gap: 2,
8
12
  position: 'absolute',
9
- top: '78%',
13
+ top: '85%',
10
14
  left: '50%',
11
15
  transform: 'translate(-50%, -50%)',
12
16
  };
@@ -40,7 +44,7 @@ export function Finish(props) {
40
44
  coordinates = coords;
41
45
  }
42
46
  props.coords.setCoords(coordinates);
43
- console.log(`ready`);
47
+ props.onTransform();
44
48
  };
45
49
  const onReset = () => {
46
50
  if (originalCoords) {
@@ -48,5 +52,21 @@ export function Finish(props) {
48
52
  setOriginalCoords(undefined);
49
53
  }
50
54
  };
51
- return (_jsxs(Box, { id: "boxButtons", sx: styleButton, children: [_jsx(Button, { variant: "contained", disabled: originalCoords !== undefined, onClick: onTransform, sx: { mr: 2 }, children: "Start Transformation" }), _jsx(Button, { variant: "contained", disabled: originalCoords === undefined, onClick: onReset, sx: { mr: 2 }, children: "Reset to Original" }), _jsx(Button, { variant: "contained", disabled: originalCoords === undefined, onClick: props.onClose(props.coords.coords), children: "Create RT1" })] }));
55
+ return (_jsxs(Box, { id: "id.Finish", sx: styleButton, children: [_jsx(Button, { variant: "contained", disabled: originalCoords !== undefined, onClick: onTransform, children: "Start Transformation" }), _jsx(Button, { variant: "contained", disabled: originalCoords === undefined, onClick: onReset, sx: { mr: 2 }, children: "Reset to Original" }), _jsx(Button, { variant: "contained", disabled: originalCoords === undefined, onClick: props.onClose(props.coords.coords), children: "Create RT1" }), _jsx(Button, { variant: "contained", onClick: () => {
56
+ props.coords.coords.save('frame.image.json');
57
+ }, children: "Save Points" }), _jsxs(Button, { variant: "contained", component: "label", children: ["Load Points", _jsx("input", { type: "file", accept: "application/json", hidden: true, onChange: async (e) => {
58
+ const file = e.target.files?.[0];
59
+ if (!file)
60
+ return;
61
+ const text = await file.text();
62
+ try {
63
+ const newPolygon = Polygon.fromJSON(JSON.parse(text));
64
+ props.coords.setCoords(newPolygon);
65
+ props.onLoad(newPolygon.Length);
66
+ }
67
+ catch {
68
+ alert(`Failed to load points from ${file.name}.`);
69
+ }
70
+ e.target.value = '';
71
+ } })] })] }));
52
72
  }
package/dist/Point.d.ts CHANGED
@@ -4,8 +4,13 @@ export declare class Point {
4
4
  private xOrigin;
5
5
  private yOrigin;
6
6
  static drawBox(context: CanvasRenderingContext2D, p1: Point, p2: Point, color: string): void;
7
+ static fromJSON(json: Point, origin?: Point): Point;
7
8
  constructor(x: number, y: number, origin?: Point);
8
9
  clone(): Point;
10
+ toJSON(): {
11
+ x: number;
12
+ y: number;
13
+ };
9
14
  get X(): number;
10
15
  get Y(): number;
11
16
  get Origin(): Point;
@@ -1 +1 @@
1
- {"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../src/Point.ts"],"names":[],"mappings":"AAAA,qBAAa,KAAK;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IAExB,MAAM,CAAC,OAAO,CACZ,OAAO,EAAE,wBAAwB,EACjC,EAAE,EAAE,KAAK,EACT,EAAE,EAAE,KAAK,EACT,KAAK,EAAE,MAAM;gBAaH,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK;IAOhD,KAAK,IAAI,KAAK;IAId,IAAI,CAAC,WAEJ;IAED,IAAI,CAAC,WAEJ;IAED,IAAI,MAAM,IAAI,KAAK,CAElB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM;IAW/B,IAAI,CACF,OAAO,EAAE,wBAAwB,EACjC,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,EACD,MAAM,SAAI,GACT,IAAI;IAsBP,SAAS,CACP,OAAO,EAAE,wBAAwB,EACjC,KAAK,SAAU,EACf,MAAM,SAAK,EACX,SAAS,SAAI,GACZ,IAAI;IAiBP,QAAQ,CACN,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,KAAK,EAC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EACf,SAAS,SAAI,GACZ,IAAI;IASP,OAAO,CAAC,MAAM,SAAI,GAAG,KAAK;CAQ3B"}
package/dist/Point.js CHANGED
@@ -9,6 +9,11 @@ export class Point {
9
9
  context.lineWidth = 3;
10
10
  context.strokeRect(p1.X + p1.Origin.X, p1.Y + p1.Origin.Y, p2.X - p1.X, p2.Y - p1.Y);
11
11
  }
12
+ static fromJSON(json, origin) {
13
+ const x = json.x;
14
+ const y = json.y;
15
+ return new Point(x, y, origin);
16
+ }
12
17
  constructor(x, y, origin) {
13
18
  this.xOrigin = origin ? origin.X : 0;
14
19
  this.yOrigin = origin ? origin.Y : 0;
@@ -18,6 +23,12 @@ export class Point {
18
23
  clone() {
19
24
  return new Point(this.X, this.Y, this.Origin);
20
25
  }
26
+ toJSON() {
27
+ return {
28
+ x: this.X,
29
+ y: this.Y,
30
+ };
31
+ }
21
32
  get X() {
22
33
  return this.x;
23
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PointsForm.d.ts","sourceRoot":"","sources":["../src/PointsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,cAAc,EAAE,KAAK,KAAK,IAAI,CAAC;CACnE,CA0FA,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"PointsForm.d.ts","sourceRoot":"","sources":["../src/PointsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,cAAc,EAAE,KAAK,KAAK,IAAI,CAAC;CACnE,CAyFA,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -41,7 +41,6 @@ const PointsForm = (props) => {
41
41
  }
42
42
  const p = new Point(x, y, origin);
43
43
  coords.push(p);
44
- console.log(`[${iloop}] -> { x: ${p.X}, y: ${p.Y}, rad: ${p.Radius}}`);
45
44
  }
46
45
  props.onCloseContinue(coords, origin);
47
46
  }, [origin, props, text]);
package/dist/Polygon.d.ts CHANGED
@@ -6,8 +6,23 @@ export declare class Polygon {
6
6
  private xMax;
7
7
  private yMin;
8
8
  private yMax;
9
+ static fromJSON(json: {
10
+ points: Point[];
11
+ universeCenter: Point;
12
+ }): Polygon;
9
13
  constructor(points: Point[], universeCenter: Point);
10
14
  clone(): Polygon;
15
+ toJSON(): {
16
+ points: {
17
+ x: number;
18
+ y: number;
19
+ }[];
20
+ universeCenter: {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ };
25
+ save(file: string): void;
11
26
  get Length(): number;
12
27
  get Points(): Point[];
13
28
  get XYPoints(): {
@@ -20,6 +35,7 @@ export declare class Polygon {
20
35
  get YMax(): number;
21
36
  get Center(): Point;
22
37
  at(index: number): Point;
38
+ set(index: number, point: Point): void;
23
39
  plus(point: Point): Polygon;
24
40
  minus(index: number): Polygon;
25
41
  findMinDistancePoint(point: Point): number;
@@ -1 +1 @@
1
- {"version":3,"file":"Polygon.d.ts","sourceRoot":"","sources":["../src/Polygon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;IACrB,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AG,IAAI;IAOtC,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAK3B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAK7B,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAY1C,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,GAAG,OAAO;IAQ/D,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAU7C,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO;IAyBjE,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAYtC,SAAS,IAAI,MAAM;IAWnB,SAAS,IAAI,MAAM;IAOnB,WAAW,IAAI,MAAM;IASrB,uBAAuB,IAAI,IAAI;IAwB/B,UAAU,CACR,OAAO,EAAE,wBAAwB,EACjC,eAAe,EAAE,OAAO,EACxB,KAAK,SAAW,GACf,IAAI;IAsBP,WAAW,CACT,OAAO,EAAE,wBAAwB,EACjC,KAAK,SAAQ,EACb,YAAY,SAAM,GACjB,IAAI;IAuBP,UAAU,CAAC,OAAO,EAAE,wBAAwB,EAAE,KAAK,SAAU,GAAG,IAAI;CAMrE"}
package/dist/Polygon.js CHANGED
@@ -8,6 +8,11 @@ export class Polygon {
8
8
  xMax;
9
9
  yMin;
10
10
  yMax;
11
+ static fromJSON(json) {
12
+ const universeCenter = Point.fromJSON(json.universeCenter);
13
+ const points = json.points.map((point) => Point.fromJSON(point, universeCenter));
14
+ return new Polygon(points, universeCenter);
15
+ }
11
16
  constructor(points, universeCenter) {
12
17
  this.points = points;
13
18
  this.xMin = Math.min(...points.map((point) => point.X));
@@ -20,6 +25,24 @@ export class Polygon {
20
25
  const clonedPoints = this.points.map((point) => point.clone());
21
26
  return new Polygon(clonedPoints, this.universeCenter);
22
27
  }
28
+ toJSON() {
29
+ return {
30
+ points: this.points.map((point) => point.toJSON()),
31
+ universeCenter: this.universeCenter.toJSON(),
32
+ };
33
+ }
34
+ save(file) {
35
+ const json = JSON.stringify(this.toJSON());
36
+ const blob = new Blob([json], { type: 'application/json' });
37
+ const url = URL.createObjectURL(blob);
38
+ const a = document.createElement('a');
39
+ a.href = url;
40
+ a.download = file;
41
+ document.body.appendChild(a);
42
+ a.click();
43
+ document.body.removeChild(a);
44
+ URL.revokeObjectURL(url);
45
+ }
23
46
  get Length() {
24
47
  return this.points.length;
25
48
  }
@@ -53,6 +76,12 @@ export class Polygon {
53
76
  }
54
77
  return this.points[index];
55
78
  }
79
+ set(index, point) {
80
+ if (index < 0 || index >= this.points.length) {
81
+ throw new Error(`Index ${index} is out of bounds for points array.`);
82
+ }
83
+ this.points[index] = point;
84
+ }
56
85
  plus(point) {
57
86
  const newPoints = [...this.Points, point];
58
87
  return new Polygon(newPoints, this.universeCenter);
@@ -114,18 +143,6 @@ export class Polygon {
114
143
  }
115
144
  createRT1() {
116
145
  let rt1 = '';
117
- const xMax = this.xMax;
118
- const xMin = this.xMin;
119
- const yMax = this.yMax;
120
- const yMin = this.yMin;
121
- console.log(`xMax: ${xMax}, xMin: ${xMin}`);
122
- console.log(`yMax: ${yMax}, yMin: ${yMin}`);
123
- console.log(`x extension: ${xMax - xMin}`);
124
- console.log(`y extension: ${yMax - yMin}`);
125
- const xCenter = (xMax + xMin) / 2;
126
- const yCenter = (yMax + yMin) / 2;
127
- console.log(`x center: ${xCenter}`);
128
- console.log(`y center: ${yCenter}`);
129
146
  for (let iloop = 0; iloop < this.points.length; iloop += 1) {
130
147
  const originalPoint = this.points[iloop];
131
148
  rt1 += Math.round(originalPoint.Radius * 10)
@@ -1,6 +1,9 @@
1
+ import { TCoordsHook } from './types';
1
2
  export declare function ScaleForm(props: {
2
3
  title: string;
4
+ coords: TCoordsHook;
3
5
  currentPoints: number;
6
+ disabled: boolean;
4
7
  sl?: number;
5
8
  sh?: number;
6
9
  onCloseCancel: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ScaleForm.d.ts","sourceRoot":"","sources":["../src/ScaleForm.tsx"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D,2CA2HA"}
1
+ {"version":3,"file":"ScaleForm.d.ts","sourceRoot":"","sources":["../src/ScaleForm.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D,2CAmMA"}
package/dist/ScaleForm.js CHANGED
@@ -1,45 +1,96 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { ScaleInput } from './ScaleInput';
4
+ import { Point } from './Point';
3
5
  export function ScaleForm(props) {
6
+ const scalingParam = 10;
4
7
  if (typeof props.currentPoints !== 'number' &&
5
8
  typeof props.currentPoints !== 'string') {
6
9
  console.error('Invalid currentPoints in ScaleForm:', props.currentPoints);
7
10
  }
11
+ const [drawnLength, setDrawnLength] = useState(props.sl ?? 0);
12
+ const [inputLength, setInputLength] = useState(props.sl ?? 0);
8
13
  const [length, setLength] = useState(props.sl ?? 0);
9
14
  const [height, setHeight] = useState(props.sh ?? 0);
15
+ const [ratio, setRatio] = useState(1);
16
+ function onChangeLength(e) {
17
+ const newLength = Math.round(parseFloat(e.target.value) * scalingParam) / scalingParam;
18
+ // ratio = length / height
19
+ // ratio * height = length
20
+ // height = length / ratio
21
+ // remember the ratio between original length and new length
22
+ // ratio = newLength / length
23
+ // newLength = ratio * length
24
+ // length = newLength / ratio
25
+ const newHeight = Math.round((newLength / ratioLength2Height) * scalingParam) /
26
+ scalingParam;
27
+ setInputLength(newLength);
28
+ setHeight(newHeight);
29
+ }
30
+ function onChangeHeight(e) {
31
+ const newHeight = Math.round(parseFloat(e.target.value) * scalingParam) / scalingParam;
32
+ const newLength = Math.round(newHeight * ratioLength2Height * scalingParam) / scalingParam;
33
+ setInputLength(newLength);
34
+ setHeight(newHeight);
35
+ }
10
36
  const handleSubmit = (e) => {
11
37
  e.preventDefault();
12
- console.log(`Scale submitted with length: ${length}, height: ${height}`);
13
- props.onCloseContinue(length, height);
38
+ const scaledPoints = [];
39
+ const scaledPolygon = props.coords.coords.clone();
40
+ for (let loop = 0; loop < scaledPolygon.Points.length; loop += 1) {
41
+ const point = scaledPolygon.Points[loop];
42
+ const angle = point.relAtan(new Point(0, 0));
43
+ // Step 2: Scale the radius
44
+ const scaledRadius = point.Radius * ratio;
45
+ // Step 3: Convert back to Cartesian coordinates
46
+ const scaledX = scaledRadius * Math.cos(angle);
47
+ const scaledY = scaledRadius * Math.sin(angle);
48
+ const scaledP = new Point(scaledX, scaledY, point.Origin);
49
+ scaledPoints.push(scaledP);
50
+ scaledPolygon.set(loop, scaledP);
51
+ }
52
+ props.coords.setCoords(scaledPolygon);
53
+ props.onCloseContinue(drawnLength, height);
14
54
  };
15
- return (_jsxs("div", { children: [_jsxs("p", { style: { color: '#666', margin: '0 0 16px 0' }, children: ["Current points defined: ", _jsx("strong", { children: props.currentPoints }), ' '] }), _jsxs("form", { onSubmit: handleSubmit, children: [_jsxs("div", { style: {
55
+ const xMin = Math.round(props.coords.coords.XMin * scalingParam) / scalingParam;
56
+ const xMax = Math.round(props.coords.coords.XMax * scalingParam) / scalingParam;
57
+ const xExtension = Math.round((xMax - xMin) * scalingParam) / scalingParam;
58
+ const yMin = Math.round(props.coords.coords.YMin * scalingParam) / scalingParam;
59
+ const yMax = Math.round(props.coords.coords.YMax * scalingParam) / scalingParam;
60
+ const yExtension = Math.round((yMax - yMin) * scalingParam) / scalingParam;
61
+ const ratioLength2Height = isFinite(yExtension)
62
+ ? Math.round((xExtension / yExtension) * 100) / 100
63
+ : 0;
64
+ useEffect(() => {
65
+ setDrawnLength(isFinite(xExtension) ? xExtension : 0);
66
+ }, [xExtension]);
67
+ useEffect(() => {
68
+ setHeight(isFinite(yExtension) ? yExtension : 0);
69
+ }, [yExtension]);
70
+ useEffect(() => {
71
+ setLength(drawnLength);
72
+ }, [drawnLength]);
73
+ useEffect(() => {
74
+ if (inputLength !== 0 && drawnLength !== 0) {
75
+ setLength(inputLength);
76
+ setRatio(inputLength / drawnLength);
77
+ }
78
+ }, [drawnLength, inputLength]);
79
+ function renderExtension(extensionString, min, max) {
80
+ const isValid = Number.isFinite(min) && Number.isFinite(max);
81
+ const ext = isValid ? Math.round((max - min) * 100) / 100 : 0;
82
+ return isValid ? (_jsxs("span", { children: [extensionString, ":", ' ', _jsxs("strong", { children: ["[", min, ", ", max, "] -> ", ext] })] })) : (_jsx("div", {}));
83
+ }
84
+ function renderRatio() {
85
+ const isValid = Number.isFinite(ratioLength2Height);
86
+ return isValid ? (_jsxs("span", { children: ["Ratio:", _jsx("strong", { children: ratioLength2Height }), _jsx("br", {})] })) : (_jsx("div", {}));
87
+ }
88
+ return (_jsxs("div", { children: ["Current points defined: ", _jsx("strong", { children: props.currentPoints }), " ", _jsx("br", {}), renderExtension('X', xMin, xMax), _jsx("br", {}), renderExtension('Y', yMin, yMax), _jsx("br", {}), renderRatio(), _jsx("br", {}), _jsxs("form", { onSubmit: handleSubmit, children: [_jsxs("div", { style: {
16
89
  display: 'flex',
17
90
  gap: '24px',
18
91
  alignItems: 'center',
19
92
  marginBottom: '16px',
20
- }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', flex: 1 }, children: [_jsx("label", { htmlFor: "scale-length", style: {
21
- marginBottom: '8px',
22
- fontWeight: 500,
23
- fontSize: '14px',
24
- }, children: "Length" }), _jsx("input", { id: "scale-length", type: "number", value: Number.isFinite(props.sl) ? props.sl : '', onChange: (e) => setLength(parseFloat(e.target.value) || 0), step: "0.1", min: "0.1", max: "10", style: {
25
- width: '100px',
26
- padding: '8px 12px',
27
- border: '1px solid #ddd',
28
- borderRadius: '4px',
29
- fontSize: '14px',
30
- boxSizing: 'border-box',
31
- }, placeholder: "Enter scale length (e.g., 1.5)", autoFocus: true })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', flex: 1 }, children: [_jsx("label", { htmlFor: "scale-height", style: {
32
- marginBottom: '8px',
33
- fontWeight: 500,
34
- fontSize: '14px',
35
- }, children: "Height" }), _jsx("input", { id: "scale-height", type: "number", value: Number.isFinite(props.sh) ? props.sh : '', onChange: (e) => setHeight(parseFloat(e.target.value) || 0), step: "0.1", min: "0.1", max: "10", style: {
36
- width: '100px',
37
- padding: '8px 12px',
38
- border: '1px solid #ddd',
39
- borderRadius: '4px',
40
- fontSize: '14px',
41
- boxSizing: 'border-box',
42
- }, placeholder: "Enter scale value (e.g., 1.5)" })] })] }), _jsx("button", { onClick: props.onCloseCancel, style: {
93
+ }, children: [_jsx(ScaleInput, { title: "Length", extension: xExtension, ratio: ratioLength2Height, scalingParam: scalingParam, value: { value: length, setValue: setLength }, setValue: onChangeLength, disabled: props.disabled }), _jsx(ScaleInput, { title: "Height", extension: yExtension, ratio: ratioLength2Height, scalingParam: scalingParam, value: { value: height, setValue: setHeight }, setValue: onChangeHeight, disabled: props.disabled })] }), _jsx("button", { onClick: props.onCloseCancel, style: {
43
94
  padding: '8px 16px',
44
95
  border: '1px solid #ddd',
45
96
  borderRadius: '4px',
@@ -0,0 +1,11 @@
1
+ import { TNumberValue } from './types';
2
+ export declare function ScaleInput(props: {
3
+ title: string;
4
+ disabled?: boolean;
5
+ extension: number;
6
+ ratio: number;
7
+ scalingParam: number;
8
+ value: TNumberValue;
9
+ setValue: (e: React.ChangeEvent<HTMLInputElement>) => void;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ //# sourceMappingURL=ScaleInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScaleInput.d.ts","sourceRoot":"","sources":["../src/ScaleInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC5D,2CAyDA"}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ export function ScaleInput(props) {
4
+ const id = `scale-${props.title.toLowerCase()}`;
5
+ const [value, setValue] = useState(props.value.value ?? 0);
6
+ function onChangeValue(e) {
7
+ const parsed = parseFloat(e.target.value);
8
+ setValue(parsed);
9
+ }
10
+ useEffect(() => {
11
+ setValue(props.value.value ?? 0);
12
+ }, [props.value]);
13
+ // useEffect(() => {
14
+ // console.log(`extension has changed to ${props.extension}`);
15
+ // props.value.setValue(props.extension);
16
+ // }, [props, props.extension]);
17
+ // useEffect(() => {
18
+ // console.log(`ratio has changed to ${props.ratio}`);
19
+ // }, [props.ratio]);
20
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', flex: 1 }, children: [_jsx("label", { htmlFor: id, style: {
21
+ marginBottom: '8px',
22
+ fontWeight: 500,
23
+ fontSize: '14px',
24
+ }, children: props.title }), _jsx("input", { id: id, type: "number", value: props.value.value, onChange: props.setValue, step: 1 / props.scalingParam, min: 1 / props.scalingParam, max: "1000", style: {
25
+ width: '100px',
26
+ padding: '8px 12px',
27
+ border: '1px solid #ddd',
28
+ borderRadius: '4px',
29
+ fontSize: '14px',
30
+ boxSizing: 'border-box',
31
+ }, placeholder: `Enter scale ${props.title.toLowerCase()} (e.g., 1.5)`, autoFocus: true, disabled: props.disabled ?? false })] }));
32
+ }
@@ -17,7 +17,7 @@ export function ShowOptions(props) {
17
17
  const handleCheckboxCatmullRomCenterChange = handleCheckboxChange('catmullRomCenter');
18
18
  const handleCheckboxCatmullRomPointsChange = handleCheckboxChange('catmullRomPoints');
19
19
  const handleCheckboxCatmullRomChange = handleCheckboxChange('catmullRom');
20
- return (_jsxs("div", { id: "idShowOptions", children: [_jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: props.show.background, onChange: (e) => handleCheckboxBackgroundChange(e) }), "Background"] }), _jsxs("div", { style: {
20
+ return (_jsxs("div", { id: "id.ShowOptions", children: [_jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: props.show.background, onChange: (e) => handleCheckboxBackgroundChange(e) }), "Background"] }), _jsxs("div", { style: {
21
21
  background: 'lightgreen',
22
22
  padding: '4px',
23
23
  borderRadius: '4px',
@@ -0,0 +1,10 @@
1
+ import { useMachine } from 'react-robot';
2
+ import { Point } from './Point';
3
+ export declare function Start(props: {
4
+ machine: ReturnType<typeof useMachine>[0];
5
+ onReset: () => void;
6
+ onAfterLoadImage: (url: string) => void;
7
+ onAfterLoadPoints: (points: Point[], universeCenter: Point) => void;
8
+ onAfterDefinePoints: () => void;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=Start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Start.d.ts","sourceRoot":"","sources":["../src/Start.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,wBAAgB,KAAK,CAAC,KAAK,EAAE;IAC3B,OAAO,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,iBAAiB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,cAAc,EAAE,KAAK,KAAK,IAAI,CAAC;IACpE,mBAAmB,EAAE,MAAM,IAAI,CAAC;CACjC,2CAwHA"}
package/dist/Start.js ADDED
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Button, Input } from '@mui/material';
3
+ import { ACTION, getValidActions, StateModal } from 'frame.statemachine';
4
+ import { useRef, useState } from 'react';
5
+ import PointsForm from './PointsForm';
6
+ export function Start(props) {
7
+ const fileInputRef = useRef(null);
8
+ const [showModalPointsForm, setShowModalPointsForm] = useState(false);
9
+ const styleButton = {
10
+ // display: 'flex',
11
+ // flexDirection: 'column',
12
+ // gap: 2,
13
+ // padding: 1,
14
+ // position: 'absolute' as const,
15
+ // top: '38%',
16
+ // left: '7%',
17
+ };
18
+ const actions = getValidActions(props.machine);
19
+ function isDisabled(action) {
20
+ return actions.findIndex((a) => a === action) === -1;
21
+ }
22
+ // --------------- reset -----------------------------------------------------
23
+ function onReset() {
24
+ props.onReset();
25
+ }
26
+ // --------------- load image ------------------------------------------------
27
+ function onLoadImage() {
28
+ fileInputRef.current?.click();
29
+ }
30
+ function onBeforeLoadPoints() {
31
+ setShowModalPointsForm(true);
32
+ }
33
+ function handleFileChange(event) {
34
+ const file = event.target.files?.[0];
35
+ if (file) {
36
+ const reader = new FileReader();
37
+ reader.onload = (e) => {
38
+ const contents = e.target?.result;
39
+ props.onAfterLoadImage(contents);
40
+ };
41
+ reader.readAsDataURL(file);
42
+ }
43
+ }
44
+ // --------------- load points -----------------------------------------------
45
+ function onClosePointsForm(cont = true) {
46
+ if (cont) {
47
+ props.onAfterDefinePoints();
48
+ }
49
+ setShowModalPointsForm(false);
50
+ }
51
+ function onLoadPointsCancel() {
52
+ onClosePointsForm(false);
53
+ }
54
+ function onAfterLoadPoints(points, universeCenter) {
55
+ props.onAfterLoadPoints(points, universeCenter);
56
+ setShowModalPointsForm(false);
57
+ }
58
+ // ---------------------------------------------------------------------------
59
+ return (_jsxs(Box, { id: "id.Start", sx: {
60
+ display: 'flex',
61
+ flexDirection: 'column',
62
+ gap: '10px',
63
+ width: '90%', // Set a fixed width for the button group
64
+ }, children: [_jsx(Button, { variant: "contained", disabled: isDisabled(ACTION.RESET), onClick: onReset, sx: { width: '100%' }, children: "Reset" }), _jsx(Input, { inputRef: fileInputRef, type: "file", inputProps: { accept: 'image/*' }, style: { display: 'none' }, onChange: handleFileChange, disabled: false }), _jsx(Button, { variant: "contained", disabled: isDisabled(ACTION.LOAD_IMAGE), onClick: onLoadImage, sx: { width: '100%' }, children: "Load Image" }), _jsx(Button, { id: "id.button.definePoints", variant: "contained", disabled: isDisabled(ACTION.DEFINE_POINTS), onClick: onBeforeLoadPoints, sx: { width: '100%' }, children: "Load Points" }), _jsx(StateModal, { isOpen: showModalPointsForm, onClose: onClosePointsForm, position: "top-right", children: _jsx(PointsForm, { title: "Import points", onCloseCancel: onLoadPointsCancel, onCloseContinue: onAfterLoadPoints }) })] }));
65
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"States.d.ts","sourceRoot":"","sources":["../src/States.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,GAAG,EAAoB,MAAM,OAAO,CAAC;AAM9C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;IACb,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,WAAW,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAuNd"}
1
+ {"version":3,"file":"States.d.ts","sourceRoot":"","sources":["../src/States.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAU,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;IACb,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,WAAW,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAuFd"}
package/dist/States.js CHANGED
@@ -1,21 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Input } from '@mui/material';
3
- import { ACTION, StateModal, STATUS, getValidActions, State, } from 'frame.statemachine';
4
- import { useRef, useState } from 'react';
5
- import { ScaleForm } from './ScaleForm';
6
- import { Action } from './Action';
7
- import PointsForm from './PointsForm';
8
- import { Polygon } from './Polygon';
3
+ import { ACTION, STATUS, State } from 'frame.statemachine';
4
+ import { useRef } from 'react';
9
5
  export function States(props) {
10
6
  const fileInputRef = useRef(null);
11
- const [showModalScaleForm, setShowModalScaleForm] = useState(false);
12
- const [showModalPointsForm, setShowModalPointsForm] = useState(false);
13
- const handleButtonClick = () => {
14
- fileInputRef.current?.click();
15
- };
16
- function onClickReset() {
17
- props.onClickReset();
18
- }
19
7
  const handleFileChange = (event) => {
20
8
  const file = event.target.files?.[0];
21
9
  if (file) {
@@ -31,77 +19,7 @@ export function States(props) {
31
19
  props.command(ACTION.LOAD_IMAGE);
32
20
  }
33
21
  };
34
- function handleClosePointsFormCancel() {
35
- onClosePointsForm(false);
36
- }
37
- function handleClosePointsFormContinue(points, universeCenter) {
38
- props.coords.setCoords(new Polygon(points, universeCenter));
39
- onClosePointsForm(true);
40
- }
41
- function handleCloseScaleFormCancel() {
42
- onCloseScaleForm(false);
43
- }
44
- function handleCloseScaleFormContinue(length, height) {
45
- props.machine.context.length = length;
46
- props.machine.context.height = height;
47
- onCloseScaleForm(true);
48
- }
49
22
  // Scale form
50
- function onCloseScaleForm(cont = true) {
51
- if (cont) {
52
- props.command(ACTION.SCALE_FORM);
53
- }
54
- setShowModalScaleForm(false);
55
- }
56
- function onClosePointsForm(cont = true) {
57
- if (cont) {
58
- props.command(ACTION.DEFINE_POINTS);
59
- }
60
- setShowModalPointsForm(false);
61
- }
62
- const onPerformCurrentAction = (action) => () => {
63
- switch (action) {
64
- case ACTION.RESET:
65
- onClickReset();
66
- break;
67
- case ACTION.LOAD_IMAGE:
68
- handleButtonClick();
69
- break;
70
- case ACTION.DEFINE_POINTS:
71
- setShowModalPointsForm(true);
72
- break;
73
- case ACTION.SCALE_FORM:
74
- setShowModalScaleForm(true);
75
- break;
76
- default:
77
- props.command(action);
78
- }
79
- };
80
- function renderAction(action, performAction) {
81
- return (_jsx(Action, { action: action, performAction: performAction }, action));
82
- }
83
- function renderActions(actions) {
84
- return actions.map((action) => {
85
- return (_jsx("span", { style: { marginRight: '10px', display: 'inline-block' }, children: renderAction(action, onPerformCurrentAction(action)) }, action));
86
- });
87
- }
88
- function checkIfActionIsEnabled(current, action) {
89
- let isEnabled = true;
90
- const context = current.context;
91
- if (action === ACTION.START_X_AXIS) {
92
- isEnabled = false;
93
- }
94
- else if (action === ACTION.FINISH_X_AXIS) {
95
- isEnabled = false;
96
- }
97
- else if (action === ACTION.DEFINE_POINTS) {
98
- isEnabled = true;
99
- }
100
- else if (action === ACTION.SCALE_FORM && context.nrPoints < 3) {
101
- isEnabled = false;
102
- }
103
- return isEnabled;
104
- }
105
23
  if (typeof props.machine.context.nrPoints !== 'number' &&
106
24
  typeof props.machine.context.nrPoints !== 'string') {
107
25
  console.error('Invalid nrPoints:', props.machine.context.nrPoints);
@@ -116,12 +34,12 @@ export function States(props) {
116
34
  heightValue,
117
35
  });
118
36
  }
119
- return (_jsxs("div", { id: "idStates", children: [_jsxs(Box, { sx: { marginBottom: 2 }, children: [_jsx("div", { style: { fontWeight: 'bold', background: 'lightblue' }, children: props.machine.name }), _jsx("br", {}), _jsx(Input, { inputRef: fileInputRef, type: "file", inputProps: { accept: 'image/*' }, style: { display: 'none' }, onChange: handleFileChange, disabled: false }), _jsx(State, { status: STATUS.START, current: props.machine }), _jsx(State, { status: STATUS.IMAGE_LOADED, current: props.machine }), _jsx(State, { status: STATUS.X_AXIS_STARTED, current: props.machine }), _jsx(State, { status: STATUS.X_AXIS_FINISHED, current: props.machine }), _jsx(State, { status: STATUS.POINTS_DEFINED, label: `${typeof props.machine.context.nrPoints === 'number' ||
120
- typeof props.machine.context.nrPoints === 'string'
121
- ? props.machine.context.nrPoints
122
- : ''} points defined`, current: props.machine, children: _jsx(StateModal, { isOpen: showModalPointsForm, onClose: onClosePointsForm, position: "top-right", children: _jsx(PointsForm, { title: "Import points", onCloseCancel: handleClosePointsFormCancel, onCloseContinue: handleClosePointsFormContinue }) }) }), _jsx(State, { status: STATUS.FORM_SCALED, current: props.machine, children: _jsx(StateModal, { isOpen: showModalScaleForm, onClose: onCloseScaleForm, position: "top-right", children: _jsx(ScaleForm, { title: "Apply Scale", currentPoints: props.machine.context.nrPoints, onCloseCancel: handleCloseScaleFormCancel, onCloseContinue: handleCloseScaleFormContinue }) }) }), _jsx(State, { status: STATUS.FORM_READY, label: `Form ready [${typeof props.machine.context.length === 'number'
123
- ? props.machine.context.length
124
- : ''} x ${typeof props.machine.context.height === 'number'
125
- ? props.machine.context.height
126
- : ''}]`, current: props.machine })] }), _jsx(Box, { sx: { display: 'flex', flexDirection: 'row', gap: 2 }, children: renderActions(getValidActions(props.machine, checkIfActionIsEnabled)) })] }));
37
+ return (_jsx("div", { id: "id.States", children: _jsxs(Box, { sx: { marginBottom: 2 }, children: [_jsx("div", { style: { fontWeight: 'bold', background: 'lightblue' }, children: props.machine.name }), _jsx("br", {}), _jsx(Input, { inputRef: fileInputRef, type: "file", inputProps: { accept: 'image/*' }, style: { display: 'none' }, onChange: handleFileChange, disabled: false }), _jsx(State, { status: STATUS.START, current: props.machine }), _jsx(State, { status: STATUS.IMAGE_LOADED, current: props.machine }), _jsx(State, { status: STATUS.X_AXIS_STARTED, current: props.machine }), _jsx(State, { status: STATUS.X_AXIS_FINISHED, current: props.machine }), _jsx(State, { status: STATUS.POINTS_DEFINED, label: `${typeof props.machine.context.nrPoints === 'number' ||
38
+ typeof props.machine.context.nrPoints === 'string'
39
+ ? props.machine.context.nrPoints
40
+ : ''} points defined`, current: props.machine }), _jsx(State, { status: STATUS.FORM_SCALED, current: props.machine }), _jsx(State, { status: STATUS.FORM_READY, label: `Form ready [${typeof props.machine.context.length === 'number'
41
+ ? props.machine.context.length
42
+ : ''} x ${typeof props.machine.context.height === 'number'
43
+ ? props.machine.context.height
44
+ : ''}]`, current: props.machine })] }) }));
127
45
  }
@@ -1 +1 @@
1
- {"root":["../src/action.tsx","../src/app.tsx","../src/center.tsx","../src/designer.tsx","../src/drawcanvas.tsx","../src/finish.tsx","../src/imagehandler.tsx","../src/lens.ts","../src/loadimage.tsx","../src/modaldesigner.tsx","../src/mousecoords.tsx","../src/point.ts","../src/pointsform.tsx","../src/polygon.ts","../src/scaleform.tsx","../src/scaling.tsx","../src/showoptions.tsx","../src/sortedpoints.ts","../src/states.tsx","../src/workflow.tsx","../src/enum.ts","../src/index.ts","../src/main.tsx","../src/types.ts","../src/vite-env.d.ts"],"version":"5.9.2"}
1
+ {"root":["../src/action.tsx","../src/app.tsx","../src/center.tsx","../src/designer.tsx","../src/drawcanvas.tsx","../src/finish.tsx","../src/imagehandler.tsx","../src/lens.ts","../src/loadimage.tsx","../src/modaldesigner.tsx","../src/mousecoords.tsx","../src/point.ts","../src/pointsform.tsx","../src/polygon.ts","../src/scaleform.tsx","../src/scaleinput.tsx","../src/scaling.tsx","../src/showoptions.tsx","../src/sortedpoints.ts","../src/start.tsx","../src/states.tsx","../src/workflow.tsx","../src/enum.ts","../src/index.ts","../src/main.tsx","../src/types.ts","../src/vite-env.d.ts"],"version":"5.9.2"}
package/dist/types.d.ts CHANGED
@@ -56,4 +56,8 @@ export type TRotationHook = {
56
56
  rotationAngle: number;
57
57
  setRotationAngle: React.Dispatch<React.SetStateAction<number>>;
58
58
  };
59
+ export type TNumberValue = {
60
+ value: number;
61
+ setValue: React.Dispatch<React.SetStateAction<number>>;
62
+ };
59
63
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,KAAK,GAAG;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EA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AAc,CAAC,OAAO,GAAG,SAAS,CAAC,CAC1C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CACxD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frame.image",
3
- "version": "1.3.4",
3
+ "version": "1.3.7",
4
4
  "description": "A React component for drawing a frame on a canvas element.",
5
5
  "license": "MIT",
6
6
  "author": "Christian.Todd@rodenstock.com",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@emotion/react": "^11.14.0",
23
23
  "@emotion/styled": "^11.14.1",
24
- "@mui/material": "^7.3.1",
24
+ "@mui/material": "^7.3.2",
25
25
  "frame.akima": "^1.2.1",
26
26
  "frame.nidek": "^1.1.4",
27
27
  "frame.statemachine": "^1.1.3",
@@ -39,9 +39,9 @@
39
39
  "eslint-plugin-react-hooks": "^5.2.0",
40
40
  "eslint-plugin-react-refresh": "^0.4.19",
41
41
  "globals": "^16.3.0",
42
- "typedoc": "^0.28.11",
42
+ "typedoc": "^0.28.12",
43
43
  "typescript": "~5.9.2",
44
44
  "typescript-eslint": "^8.41.0",
45
- "vite": "^7.1.3"
45
+ "vite": "^7.1.4"
46
46
  }
47
47
  }