seat-editor 3.3.13 → 3.3.15
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/dist/app/constant.d.ts +1 -0
- package/dist/app/constant.js +1 -0
- package/dist/app/layout.d.ts +6 -0
- package/dist/app/layout.jsx +27 -0
- package/dist/app/new-board/page.jsx +55 -0
- package/dist/app/old-board/page.d.ts +3 -0
- package/dist/app/old-board/page.jsx +510 -0
- package/dist/app/only-view/chair.d.ts +1 -0
- package/dist/app/only-view/chair.js +12 -0
- package/dist/app/only-view/constant.d.ts +60 -0
- package/dist/app/only-view/constant.js +1336 -0
- package/dist/app/only-view/page.jsx +248 -0
- package/dist/app/only-view/user.d.ts +1 -0
- package/dist/app/only-view/user.js +12 -0
- package/dist/app/page.d.ts +2 -0
- package/dist/app/page.jsx +13 -0
- package/dist/app/test/page.d.ts +2 -0
- package/dist/app/test/page.jsx +45 -0
- package/dist/app/v2/page.d.ts +2 -0
- package/dist/app/v2/page.jsx +13 -0
- package/dist/components/button-tools/index.d.ts +11 -0
- package/dist/components/button-tools/index.jsx +17 -0
- package/dist/components/form-tools/label.d.ts +2 -0
- package/dist/components/form-tools/label.jsx +63 -0
- package/dist/components/form-tools/shape.d.ts +8 -0
- package/dist/components/form-tools/shape.jsx +113 -0
- package/dist/components/input/number-indicator.d.ts +7 -0
- package/dist/components/input/number-indicator.jsx +36 -0
- package/dist/components/joystick/index.d.ts +12 -0
- package/dist/components/joystick/index.jsx +49 -0
- package/dist/components/layer/index.d.ts +19 -0
- package/dist/components/layer/index.jsx +383 -0
- package/dist/components/layer-v2/index.d.ts +19 -0
- package/dist/components/layer-v2/index.jsx +370 -0
- package/dist/components/layer-v3/index.d.ts +13 -0
- package/dist/components/layer-v3/index.jsx +631 -0
- package/dist/components/layer-v3/utils.d.ts +19 -0
- package/dist/components/layer-v3/utils.js +72 -0
- package/dist/components/layer-v4/constant.d.ts +60 -0
- package/dist/components/layer-v4/constant.js +93 -0
- package/dist/components/layer-v4/index.d.ts +24 -0
- package/dist/components/layer-v4/index.jsx +1046 -0
- package/dist/components/lib/index.d.ts +8 -0
- package/dist/components/lib/index.jsx +33 -0
- package/dist/components/modal-preview/index.d.ts +4 -0
- package/dist/components/modal-preview/index.jsx +11 -0
- package/dist/dto/event-handler.d.ts +1 -0
- package/dist/dto/event-handler.js +1 -0
- package/dist/dto/table.d.ts +80 -0
- package/dist/dto/table.js +1 -0
- package/dist/features/board/board-slice.d.ts +14 -0
- package/dist/features/board/board-slice.js +52 -0
- package/dist/features/board/index.d.ts +6 -0
- package/dist/features/board/index.jsx +725 -0
- package/dist/features/board-v2/board-slice.d.ts +14 -0
- package/dist/features/board-v2/board-slice.js +52 -0
- package/dist/features/board-v2/index.d.ts +8 -0
- package/dist/features/board-v2/index.jsx +869 -0
- package/dist/features/board-v3/board-slice.d.ts +19 -0
- package/dist/features/board-v3/board-slice.js +274 -0
- package/dist/features/board-v3/constant.d.ts +5 -0
- package/dist/features/board-v3/constant.js +5 -0
- package/dist/features/board-v3/history-slice.d.ts +27 -0
- package/dist/features/board-v3/history-slice.js +27 -0
- package/dist/features/board-v3/icons.d.ts +4 -0
- package/dist/features/board-v3/icons.jsx +100 -0
- package/dist/features/board-v3/index.d.ts +16 -0
- package/dist/features/board-v3/index.jsx +1678 -0
- package/dist/features/board-v3/polygon.d.ts +28 -0
- package/dist/features/board-v3/polygon.js +109 -0
- package/dist/features/board-v3/rect.d.ts +9 -0
- package/dist/features/board-v3/rect.js +152 -0
- package/dist/features/board-v3/resize-element.d.ts +12 -0
- package/dist/features/board-v3/resize-element.js +43 -0
- package/dist/features/board-v3/utils.d.ts +180 -0
- package/dist/features/board-v3/utils.js +1235 -0
- package/dist/features/navbar/index.d.ts +2 -0
- package/dist/features/navbar/index.jsx +5 -0
- package/dist/features/panel/index.d.ts +6 -0
- package/dist/features/panel/index.jsx +251 -0
- package/dist/features/panel/panel-slice.d.ts +23 -0
- package/dist/features/panel/panel-slice.js +46 -0
- package/dist/features/panel/select-tool.d.ts +6 -0
- package/dist/features/panel/select-tool.jsx +70 -0
- package/dist/features/panel/selected-group.d.ts +2 -0
- package/dist/features/panel/selected-group.jsx +93 -0
- package/dist/features/panel/square-circle-tool.d.ts +2 -0
- package/dist/features/panel/square-circle-tool.jsx +10 -0
- package/dist/features/panel/table-seat-circle.d.ts +2 -0
- package/dist/features/panel/table-seat-circle.jsx +36 -0
- package/dist/features/panel/table-seat-square.d.ts +2 -0
- package/dist/features/panel/table-seat-square.jsx +51 -0
- package/dist/features/panel/text-tool.d.ts +2 -0
- package/dist/features/panel/text-tool.jsx +57 -0
- package/dist/features/panel/upload-tool.d.ts +10 -0
- package/dist/features/panel/upload-tool.jsx +176 -0
- package/dist/features/panel/utils.d.ts +5 -0
- package/dist/features/panel/utils.js +47 -0
- package/dist/features/side-tool/index.d.ts +8 -0
- package/dist/features/side-tool/index.jsx +390 -0
- package/dist/features/side-tool/side-tool-slice.d.ts +16 -0
- package/dist/features/side-tool/side-tool-slice.js +28 -0
- package/dist/features/theme/theme-slice.d.ts +12 -0
- package/dist/features/theme/theme-slice.js +15 -0
- package/dist/features/view-only/index.d.ts +19 -0
- package/dist/features/view-only/index.jsx +205 -0
- package/dist/features/view-only-2/index.d.ts +19 -0
- package/dist/features/view-only-2/index.jsx +190 -0
- package/dist/features/view-only-3/index.d.ts +89 -0
- package/dist/features/view-only-3/index.jsx +590 -0
- package/dist/features/view-only-3/utils.d.ts +1 -0
- package/dist/features/view-only-3/utils.js +3 -0
- package/dist/hooks/use-redux.d.ts +4 -0
- package/dist/hooks/use-redux.js +3 -0
- package/dist/index.js +10 -0
- package/dist/libs/middleware.d.ts +2 -0
- package/dist/libs/middleware.js +5 -0
- package/dist/libs/rootReducer.d.ts +12 -0
- package/dist/libs/rootReducer.js +14 -0
- package/dist/libs/store.d.ts +18 -0
- package/dist/libs/store.js +19 -0
- package/dist/provider/antd-provider.d.ts +4 -0
- package/dist/provider/antd-provider.jsx +46 -0
- package/dist/provider/redux-provider.d.ts +3 -0
- package/dist/provider/redux-provider.jsx +6 -0
- package/dist/provider/store-provider.d.ts +4 -0
- package/dist/provider/store-provider.jsx +10 -0
- package/dist/utils/constant.d.ts +3 -0
- package/dist/utils/constant.js +13 -0
- package/dist/utils/format.d.ts +2 -0
- package/dist/utils/format.js +29 -0
- package/dist/utils/injectCss.d.ts +1 -0
- package/dist/utils/injectCss.js +13 -0
- package/dist/utils/regex.d.ts +3 -0
- package/dist/utils/regex.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AllTypElement } from "./resize-element";
|
|
2
|
+
export type Point = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
export interface PolygonBox {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
minX?: number;
|
|
12
|
+
minY?: number;
|
|
13
|
+
maxX?: number;
|
|
14
|
+
maxY?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse SVG polygon string → array of points
|
|
18
|
+
* Example input: "10,20 30,40 50,10"
|
|
19
|
+
*/
|
|
20
|
+
export declare function parsePolygonPoints(pointsStr: string): Point[];
|
|
21
|
+
/**
|
|
22
|
+
* Convert polygon points → bounding box
|
|
23
|
+
*/
|
|
24
|
+
export declare function polygonPointsToBoxFromString(pointsStr: string): PolygonBox;
|
|
25
|
+
export declare function resizePolygon(target: {
|
|
26
|
+
g: SVGGElement;
|
|
27
|
+
element: AllTypElement;
|
|
28
|
+
}, handle: string, dx: number, dy: number): void;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse SVG polygon string → array of points
|
|
3
|
+
* Example input: "10,20 30,40 50,10"
|
|
4
|
+
*/
|
|
5
|
+
export function parsePolygonPoints(pointsStr) {
|
|
6
|
+
if (!pointsStr.trim())
|
|
7
|
+
return [];
|
|
8
|
+
return pointsStr
|
|
9
|
+
.trim()
|
|
10
|
+
.split(/\s+/) // split via spaces
|
|
11
|
+
.map(pair => {
|
|
12
|
+
const [x, y] = pair.split(/,| /).map(Number); // support "10,20" or "10 20"
|
|
13
|
+
return { x, y };
|
|
14
|
+
})
|
|
15
|
+
.filter(p => !Number.isNaN(p.x) && !Number.isNaN(p.y));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Convert polygon points → bounding box
|
|
19
|
+
*/
|
|
20
|
+
export function polygonPointsToBoxFromString(pointsStr) {
|
|
21
|
+
const points = parsePolygonPoints(pointsStr);
|
|
22
|
+
if (points.length === 0) {
|
|
23
|
+
return { x: 0, y: 0, width: 0, height: 0, minX: 0, minY: 0, maxX: 0, maxY: 0 };
|
|
24
|
+
}
|
|
25
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
26
|
+
for (const p of points) {
|
|
27
|
+
if (p.x < minX)
|
|
28
|
+
minX = p.x;
|
|
29
|
+
if (p.y < minY)
|
|
30
|
+
minY = p.y;
|
|
31
|
+
if (p.x > maxX)
|
|
32
|
+
maxX = p.x;
|
|
33
|
+
if (p.y > maxY)
|
|
34
|
+
maxY = p.y;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
x: minX,
|
|
38
|
+
y: minY,
|
|
39
|
+
width: maxX - minX,
|
|
40
|
+
height: maxY - minY,
|
|
41
|
+
// minX,
|
|
42
|
+
// minY,
|
|
43
|
+
// maxX,
|
|
44
|
+
// maxY
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function resizePolygon(target, handle, dx, dy) {
|
|
48
|
+
const { g, element } = target;
|
|
49
|
+
const polygon = element;
|
|
50
|
+
// --- 1. Ambil points asli ---
|
|
51
|
+
const points = [];
|
|
52
|
+
for (let i = 0; i < polygon.points.numberOfItems; i++) {
|
|
53
|
+
const p = polygon.points.getItem(i);
|
|
54
|
+
points.push({ x: p.x, y: p.y });
|
|
55
|
+
}
|
|
56
|
+
// --- 2. Hitung bounding box polygon ---
|
|
57
|
+
let minX = Infinity, minY = Infinity;
|
|
58
|
+
let maxX = -Infinity, maxY = -Infinity;
|
|
59
|
+
for (const p of points) {
|
|
60
|
+
if (p.x < minX)
|
|
61
|
+
minX = p.x;
|
|
62
|
+
if (p.y < minY)
|
|
63
|
+
minY = p.y;
|
|
64
|
+
if (p.x > maxX)
|
|
65
|
+
maxX = p.x;
|
|
66
|
+
if (p.y > maxY)
|
|
67
|
+
maxY = p.y;
|
|
68
|
+
}
|
|
69
|
+
let w = maxX - minX;
|
|
70
|
+
let h = maxY - minY;
|
|
71
|
+
// posisi group translate
|
|
72
|
+
let gx = g.transform.baseVal.getItem(0).matrix.e;
|
|
73
|
+
let gy = g.transform.baseVal.getItem(0).matrix.f;
|
|
74
|
+
console.log({ gx, gy });
|
|
75
|
+
// --- 3. Map handle operations (mirip punya kamu) ---
|
|
76
|
+
const ops = {
|
|
77
|
+
n: () => { h -= dy; gy += dy; },
|
|
78
|
+
s: () => { h += dy; },
|
|
79
|
+
w: () => { w -= dx; gx += dx; },
|
|
80
|
+
e: () => { w += dx; },
|
|
81
|
+
nw: () => { ops.n(); ops.w(); },
|
|
82
|
+
ne: () => { ops.n(); ops.e(); },
|
|
83
|
+
sw: () => { ops.s(); ops.w(); },
|
|
84
|
+
se: () => { ops.s(); ops.e(); }
|
|
85
|
+
};
|
|
86
|
+
ops[handle]();
|
|
87
|
+
// --- 4. Minimal width/height ---
|
|
88
|
+
w = Math.max(10, w);
|
|
89
|
+
h = Math.max(10, h);
|
|
90
|
+
// --- 5. Scale ulang semua points berdasarkan bounding box baru ---
|
|
91
|
+
const oldW = maxX - minX;
|
|
92
|
+
const oldH = maxY - minY;
|
|
93
|
+
const sx = w / oldW;
|
|
94
|
+
const sy = h / oldH;
|
|
95
|
+
const newPoints = points.map(p => ({
|
|
96
|
+
x: (p.x - minX) * sx + minX,
|
|
97
|
+
y: (p.y - minY) * sy + minY,
|
|
98
|
+
}));
|
|
99
|
+
// --- 6. Update points polygon ---
|
|
100
|
+
polygon.points.clear();
|
|
101
|
+
newPoints.forEach(np => {
|
|
102
|
+
const pt = polygon.ownerSVGElement.createSVGPoint();
|
|
103
|
+
pt.x = np.x;
|
|
104
|
+
pt.y = np.y;
|
|
105
|
+
polygon.points.appendItem(pt);
|
|
106
|
+
});
|
|
107
|
+
// --- 7. Update posisi group (gx/gy) ---
|
|
108
|
+
g.setAttribute("transform", `translate(${gx}, ${gy})`);
|
|
109
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AllTypElement } from "./resize-element";
|
|
2
|
+
export declare function resizeRect(target: {
|
|
3
|
+
g: SVGGElement;
|
|
4
|
+
element: AllTypElement;
|
|
5
|
+
}, handle: string, dx: number, dy: number): void;
|
|
6
|
+
export declare function resizeRectTes(target: {
|
|
7
|
+
g: SVGGElement;
|
|
8
|
+
element: AllTypElement;
|
|
9
|
+
}, handle: string, dx: number, dy: number): void;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
export function resizeRect(target, handle, dx, dy) {
|
|
2
|
+
var _a;
|
|
3
|
+
const { g, element } = target;
|
|
4
|
+
const rect = element;
|
|
5
|
+
let w = rect.width.baseVal.value;
|
|
6
|
+
let h = rect.height.baseVal.value;
|
|
7
|
+
let gx = g.transform.baseVal.getItem(0).matrix.e;
|
|
8
|
+
let gy = g.transform.baseVal.getItem(0).matrix.f;
|
|
9
|
+
let angle = (_a = g.firstChild) === null || _a === void 0 ? void 0 : _a.transform.baseVal.getItem(0).angle;
|
|
10
|
+
console.log({ dx, dy });
|
|
11
|
+
if (angle !== 0) {
|
|
12
|
+
const rad = angle * Math.PI / 180;
|
|
13
|
+
const localDx = dx * Math.cos(-rad) - dy * Math.sin(-rad);
|
|
14
|
+
const localDy = dx * Math.sin(-rad) + dy * Math.cos(-rad);
|
|
15
|
+
console.log({ localDx, localDy });
|
|
16
|
+
if (handle === "se") {
|
|
17
|
+
w = gx + localDx;
|
|
18
|
+
h = gy + localDy;
|
|
19
|
+
}
|
|
20
|
+
console.log({ w, h });
|
|
21
|
+
rect.width.baseVal.value = w;
|
|
22
|
+
rect.height.baseVal.value = h;
|
|
23
|
+
// apply new translate (for left/top resizing)
|
|
24
|
+
const transform = g.transform.baseVal.getItem(0);
|
|
25
|
+
transform.setTranslate(gx, gy);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const ops = {
|
|
29
|
+
n: () => {
|
|
30
|
+
h -= dy;
|
|
31
|
+
gy += dy;
|
|
32
|
+
},
|
|
33
|
+
s: () => {
|
|
34
|
+
h = gy + dy;
|
|
35
|
+
},
|
|
36
|
+
w: () => {
|
|
37
|
+
w -= dx;
|
|
38
|
+
gx += dx;
|
|
39
|
+
},
|
|
40
|
+
e: () => {
|
|
41
|
+
w = gx + dx;
|
|
42
|
+
},
|
|
43
|
+
nw: () => {
|
|
44
|
+
ops.n();
|
|
45
|
+
ops.w();
|
|
46
|
+
},
|
|
47
|
+
ne: () => {
|
|
48
|
+
ops.n();
|
|
49
|
+
ops.e();
|
|
50
|
+
},
|
|
51
|
+
sw: () => {
|
|
52
|
+
ops.s();
|
|
53
|
+
ops.w();
|
|
54
|
+
},
|
|
55
|
+
se: () => {
|
|
56
|
+
ops.s();
|
|
57
|
+
ops.e();
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
const op = ops[handle];
|
|
61
|
+
ops[handle]();
|
|
62
|
+
//
|
|
63
|
+
// minimal constraints
|
|
64
|
+
w = Math.max(10, w);
|
|
65
|
+
h = Math.max(10, h);
|
|
66
|
+
rect.width.baseVal.value = w;
|
|
67
|
+
rect.height.baseVal.value = h;
|
|
68
|
+
// apply new translate (for left/top resizing)
|
|
69
|
+
// const transform = g.transform.baseVal.getItem(0);
|
|
70
|
+
// transform.setTranslate(gx, gy);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export function resizeRectTes(target, handle, dx, dy) {
|
|
74
|
+
var _a;
|
|
75
|
+
const { g, element } = target;
|
|
76
|
+
const rect = element;
|
|
77
|
+
let w = rect.width.baseVal.value;
|
|
78
|
+
let h = rect.height.baseVal.value;
|
|
79
|
+
let gx = g.transform.baseVal.getItem(0).matrix.e;
|
|
80
|
+
let gy = g.transform.baseVal.getItem(0).matrix.f;
|
|
81
|
+
// angle dari group inner
|
|
82
|
+
const angle = ((_a = g.firstChild) === null || _a === void 0 ? void 0 : _a.transform.baseVal.getItem(0).angle) || 0;
|
|
83
|
+
// // RIGHT
|
|
84
|
+
// const newW = pos.x - gx;
|
|
85
|
+
// scaleX = newW / gw;
|
|
86
|
+
// ax = gx;
|
|
87
|
+
// ay = gy;
|
|
88
|
+
// newW1 = Math.max(minW, pos.x - gx);
|
|
89
|
+
// newX1 = gx;
|
|
90
|
+
// // BOTTOM
|
|
91
|
+
// const newH = pos.y - gy;
|
|
92
|
+
// scaleY = newH / gh;
|
|
93
|
+
// ax = gx;
|
|
94
|
+
// ay = gy;
|
|
95
|
+
// newH1 = pos.y - y;
|
|
96
|
+
// newY1 = y;
|
|
97
|
+
console.log({ angle });
|
|
98
|
+
if (angle !== 0) {
|
|
99
|
+
const opsScale = {
|
|
100
|
+
se: () => {
|
|
101
|
+
ops.s();
|
|
102
|
+
ops.e();
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
opsScale[handle]();
|
|
106
|
+
}
|
|
107
|
+
const rad = -angle * (Math.PI / 180); // inverse rotation
|
|
108
|
+
// convert mouse movement ke local axis
|
|
109
|
+
const localDx = dx * Math.cos(rad) - dy * Math.sin(rad);
|
|
110
|
+
const localDy = dx * Math.sin(rad) + dy * Math.cos(rad);
|
|
111
|
+
const ops = {
|
|
112
|
+
n: () => {
|
|
113
|
+
h -= localDy;
|
|
114
|
+
gy += localDy;
|
|
115
|
+
},
|
|
116
|
+
s: () => {
|
|
117
|
+
h += localDy;
|
|
118
|
+
},
|
|
119
|
+
w: () => {
|
|
120
|
+
w -= localDx;
|
|
121
|
+
gx += localDx;
|
|
122
|
+
},
|
|
123
|
+
e: () => {
|
|
124
|
+
w += localDx;
|
|
125
|
+
},
|
|
126
|
+
nw: () => {
|
|
127
|
+
ops.n();
|
|
128
|
+
ops.w();
|
|
129
|
+
},
|
|
130
|
+
ne: () => {
|
|
131
|
+
ops.n();
|
|
132
|
+
ops.e();
|
|
133
|
+
},
|
|
134
|
+
sw: () => {
|
|
135
|
+
ops.s();
|
|
136
|
+
ops.w();
|
|
137
|
+
},
|
|
138
|
+
se: () => {
|
|
139
|
+
ops.s();
|
|
140
|
+
ops.e();
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
ops[handle]();
|
|
144
|
+
// minimal constraints
|
|
145
|
+
w = Math.max(10, w);
|
|
146
|
+
h = Math.max(10, h);
|
|
147
|
+
rect.width.baseVal.value = w;
|
|
148
|
+
rect.height.baseVal.value = h;
|
|
149
|
+
// apply new translate (for left/top resizing)
|
|
150
|
+
const transform = g.transform.baseVal.getItem(0);
|
|
151
|
+
transform.setTranslate(gx, gy);
|
|
152
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AllTypElement = SVGRectElement | SVGPolygonElement;
|
|
2
|
+
interface ResizeTarget {
|
|
3
|
+
g: SVGGElement;
|
|
4
|
+
inner: SVGGElement;
|
|
5
|
+
element: AllTypElement;
|
|
6
|
+
seats?: NodeListOf<SVGGElement>;
|
|
7
|
+
seatGroup?: SVGGElement;
|
|
8
|
+
points?: any[];
|
|
9
|
+
}
|
|
10
|
+
export declare function getAttributeElement(root: SVGSVGElement, id: string): ResizeTarget | null;
|
|
11
|
+
export declare function getAttributeElements(root: SVGSVGElement, id: string[]): ResizeTarget[];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { pointsStringToArray } from "./utils";
|
|
2
|
+
export function getAttributeElement(root, id) {
|
|
3
|
+
var _a;
|
|
4
|
+
const g = root.querySelector(`g[data-id="${id}"]`);
|
|
5
|
+
const seats = root.querySelectorAll(`g[data-seat="${id}-seats"]`);
|
|
6
|
+
const seatGroup = root.querySelector(`g[data-seat="${id}-seats"]`);
|
|
7
|
+
if (!g)
|
|
8
|
+
return { g, inner: null, element: null };
|
|
9
|
+
const inner = g.querySelector("g");
|
|
10
|
+
const tagName = (_a = inner === null || inner === void 0 ? void 0 : inner.firstChild) === null || _a === void 0 ? void 0 : _a.tagName;
|
|
11
|
+
let listSeats = [];
|
|
12
|
+
let element = null;
|
|
13
|
+
let points = [];
|
|
14
|
+
if (tagName === "polygon") {
|
|
15
|
+
const polygon = (inner === null || inner === void 0 ? void 0 : inner.firstChild);
|
|
16
|
+
const rawPoints = polygon === null || polygon === void 0 ? void 0 : polygon.getAttribute("points");
|
|
17
|
+
//convert to json x y
|
|
18
|
+
points = pointsStringToArray(rawPoints);
|
|
19
|
+
element = polygon;
|
|
20
|
+
// const coor = polygonPointsToBoxFromString(polygonPoints);
|
|
21
|
+
}
|
|
22
|
+
if (tagName === "rect") {
|
|
23
|
+
const rect = inner === null || inner === void 0 ? void 0 : inner.querySelector("rect");
|
|
24
|
+
element = rect;
|
|
25
|
+
}
|
|
26
|
+
if (tagName === "circle") {
|
|
27
|
+
const circle = inner === null || inner === void 0 ? void 0 : inner.querySelector("circle");
|
|
28
|
+
element = circle;
|
|
29
|
+
}
|
|
30
|
+
if (tagName === "image") {
|
|
31
|
+
const image = inner === null || inner === void 0 ? void 0 : inner.querySelector("image");
|
|
32
|
+
element = image;
|
|
33
|
+
}
|
|
34
|
+
if (seats.length !== 0) {
|
|
35
|
+
listSeats = seats[0].children;
|
|
36
|
+
}
|
|
37
|
+
if (!inner || !element)
|
|
38
|
+
return null;
|
|
39
|
+
return { g, inner, element, seats: listSeats, seatGroup, points };
|
|
40
|
+
}
|
|
41
|
+
export function getAttributeElements(root, id) {
|
|
42
|
+
return id.map((id) => getAttributeElement(root, id));
|
|
43
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
export declare const resizeElementSelection: ({ selectionStart, currentSelection, rotate, element, mouse, mouseCurrent, }: {
|
|
2
|
+
selectionStart: any;
|
|
3
|
+
currentSelection: any;
|
|
4
|
+
rotate: any;
|
|
5
|
+
element: any;
|
|
6
|
+
mouse: any;
|
|
7
|
+
mouseCurrent: any;
|
|
8
|
+
}) => {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function resizeBox({ box, dx, dy, rotate, handle }: {
|
|
13
|
+
box: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
dx: number;
|
|
20
|
+
dy: number;
|
|
21
|
+
rotate: number;
|
|
22
|
+
handle: ResizeHandle;
|
|
23
|
+
}): {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
};
|
|
29
|
+
export type ResizeHandle = "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
30
|
+
export declare function getAnchorByHandle(handle: ResizeHandle, box: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
}): {
|
|
36
|
+
ax: number;
|
|
37
|
+
ay: number;
|
|
38
|
+
};
|
|
39
|
+
interface ResizeSeatSquare {
|
|
40
|
+
seatsPositions: {
|
|
41
|
+
top: number;
|
|
42
|
+
right: number;
|
|
43
|
+
bottom: number;
|
|
44
|
+
left: number;
|
|
45
|
+
};
|
|
46
|
+
r: number;
|
|
47
|
+
openSpace: number;
|
|
48
|
+
newElement: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
};
|
|
54
|
+
seats: NodeListOf<SVGGElement>;
|
|
55
|
+
seatGroup: SVGGElement;
|
|
56
|
+
}
|
|
57
|
+
export declare const resizeSeatSquare: ({ seatsPositions, r, openSpace, newElement, seats, seatGroup, }: ResizeSeatSquare) => void;
|
|
58
|
+
export declare const resizeSeatCircle: ({ seatCount, r, openSpace, seats, seatGroup, newElement, }: {
|
|
59
|
+
seatCount: any;
|
|
60
|
+
r?: number;
|
|
61
|
+
openSpace: any;
|
|
62
|
+
seats: any;
|
|
63
|
+
seatGroup: any;
|
|
64
|
+
newElement: any;
|
|
65
|
+
}) => void;
|
|
66
|
+
export declare const resizeSeatSide: ({ seatsPositions, r, openSpace, newElement, seats, seatGroup, }: ResizeSeatSquare) => void;
|
|
67
|
+
export declare const resizeSeatRectCircle: ({ seatsPositions, r, openSpace, newElement, seats, seatGroup, }: ResizeSeatSquare) => void;
|
|
68
|
+
export declare const resizeSeatRectSquare: ({ seatsPositions, r, openSpace, newElement, seats, seatGroup, }: ResizeSeatSquare) => void;
|
|
69
|
+
export declare function mergeById<T extends {
|
|
70
|
+
id?: string;
|
|
71
|
+
}>(base: T[], updates: Partial<T>[]): T[];
|
|
72
|
+
export declare function updateSingleComponent<T extends {
|
|
73
|
+
id?: any;
|
|
74
|
+
}>(state: T[], component: Partial<T>, setState: (v: T[]) => void): T[];
|
|
75
|
+
export declare function updateManyComponents<T extends {
|
|
76
|
+
id?: string;
|
|
77
|
+
}>(state: T[], components: Partial<T>[], setState: (v: T[]) => void): T[];
|
|
78
|
+
export declare function normalizeAngle(angle: number): number;
|
|
79
|
+
export declare function createTableGhost({ x, y, width, height, fill, shape, id, }: {
|
|
80
|
+
x: any;
|
|
81
|
+
y: any;
|
|
82
|
+
width: any;
|
|
83
|
+
height: any;
|
|
84
|
+
fill: any;
|
|
85
|
+
shape: any;
|
|
86
|
+
id?: string;
|
|
87
|
+
}): any;
|
|
88
|
+
export declare function updateSelectionBox(svg: SVGSVGElement, boxSelection: {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
width: number;
|
|
92
|
+
height: number;
|
|
93
|
+
}, id?: string, unFollowCursor?: boolean): void;
|
|
94
|
+
export declare function getGlobalBBox(svg: SVGSVGElement, el: SVGGraphicsElement): {
|
|
95
|
+
x: number;
|
|
96
|
+
y: number;
|
|
97
|
+
width: number;
|
|
98
|
+
height: number;
|
|
99
|
+
};
|
|
100
|
+
export declare function getTranslate(el: any): {
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
};
|
|
104
|
+
export declare function getSize(el: any): {
|
|
105
|
+
width: any;
|
|
106
|
+
height: any;
|
|
107
|
+
};
|
|
108
|
+
export declare function stabilizeRotation(tx: any, ty: any, W: any, H: any, oldAngle: any, newAngle: any): {
|
|
109
|
+
tx: any;
|
|
110
|
+
ty: any;
|
|
111
|
+
};
|
|
112
|
+
export declare function isClosingPolygon(mouseX: any, mouseY: any, points: any): boolean;
|
|
113
|
+
type ResizeSide = string;
|
|
114
|
+
export declare function getPolygonCenter(points: Pt[]): {
|
|
115
|
+
cx: number;
|
|
116
|
+
cy: number;
|
|
117
|
+
};
|
|
118
|
+
type Pt = {
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
};
|
|
122
|
+
export declare function stabilizeTranslateOnRotate({ points, oldAngle, newAngle, tx, ty, }: {
|
|
123
|
+
points: Pt[];
|
|
124
|
+
oldAngle: number;
|
|
125
|
+
newAngle: number;
|
|
126
|
+
tx: number;
|
|
127
|
+
ty: number;
|
|
128
|
+
}): {
|
|
129
|
+
tx: number;
|
|
130
|
+
ty: number;
|
|
131
|
+
};
|
|
132
|
+
export declare function pointsStringToArray(pointsStr: string): Pt[];
|
|
133
|
+
export declare function arrayToSvgPointsAttr(points: Pt[]): string;
|
|
134
|
+
type Size = {
|
|
135
|
+
width: number;
|
|
136
|
+
height: number;
|
|
137
|
+
};
|
|
138
|
+
export declare function getSvgElementSize(el: SVGGraphicsElement): Size | null;
|
|
139
|
+
type ResizeResult = {
|
|
140
|
+
x: number;
|
|
141
|
+
y: number;
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
points?: Pt[];
|
|
145
|
+
};
|
|
146
|
+
type ElementComponent = {
|
|
147
|
+
fill: string;
|
|
148
|
+
};
|
|
149
|
+
export declare function applyResizeToSvgElement(element: SVGGraphicsElement, group: SVGGElement, resize: ResizeResult, component?: ElementComponent): void;
|
|
150
|
+
type ResizeParams = {
|
|
151
|
+
element: SVGGraphicsElement;
|
|
152
|
+
group: SVGGElement;
|
|
153
|
+
resizeSide: ResizeSide;
|
|
154
|
+
widthOriginal: number;
|
|
155
|
+
heightOriginal: number;
|
|
156
|
+
deltaLocalX: number;
|
|
157
|
+
deltaLocalY: number;
|
|
158
|
+
xOriginal: number;
|
|
159
|
+
yOriginal: number;
|
|
160
|
+
angle: number;
|
|
161
|
+
seats?: any;
|
|
162
|
+
};
|
|
163
|
+
export declare function applyResizeWithRotation({ element, group, resizeSide, widthOriginal, heightOriginal, deltaLocalX, deltaLocalY, xOriginal, yOriginal, angle, seats, }: ResizeParams): void;
|
|
164
|
+
export declare function getRotation(transformList: any): any;
|
|
165
|
+
type Rect = {
|
|
166
|
+
x: number;
|
|
167
|
+
y: number;
|
|
168
|
+
width: number;
|
|
169
|
+
height: number;
|
|
170
|
+
};
|
|
171
|
+
type GuideLineIds = {
|
|
172
|
+
vLeft: string;
|
|
173
|
+
vCenter: string;
|
|
174
|
+
vRight: string;
|
|
175
|
+
hTop: string;
|
|
176
|
+
hCenter: string;
|
|
177
|
+
hBottom: string;
|
|
178
|
+
};
|
|
179
|
+
export declare const updateSelectionGuides: (svg: SVGSVGElement | null, rect: Rect, ids: GuideLineIds, range?: number) => void;
|
|
180
|
+
export {};
|