seat-editor 3.2.2 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/constant.js +3 -3
- package/dist/app/new-board/page.jsx +8 -20
- package/dist/app/only-view/page.jsx +3 -1
- package/dist/components/layer-v3/index.jsx +5 -5
- package/dist/components/layer-v4/index.jsx +3 -3
- package/dist/features/board-v3/board-slice.js +79 -9
- package/dist/features/board-v3/index.jsx +82 -24
- package/dist/features/package/index.d.ts +6 -0
- package/dist/features/package/index.jsx +18 -15
- package/dist/features/panel/index.jsx +21 -8
- package/dist/features/panel/upload-tool.jsx +3 -0
- package/dist/features/panel/utils.js +1 -1
- package/dist/features/view-only-3/index.d.ts +4 -2
- package/dist/features/view-only-3/index.jsx +21 -13
- package/package.json +1 -1
package/dist/app/constant.js
CHANGED
|
@@ -3372,7 +3372,7 @@ export const data4 = [
|
|
|
3372
3372
|
uuid_table: "axxxxx",
|
|
3373
3373
|
status: 0,
|
|
3374
3374
|
properties: {
|
|
3375
|
-
x:
|
|
3375
|
+
x: 500,
|
|
3376
3376
|
y: 520,
|
|
3377
3377
|
labels: [
|
|
3378
3378
|
{
|
|
@@ -3455,7 +3455,7 @@ export const data4 = [
|
|
|
3455
3455
|
},
|
|
3456
3456
|
],
|
|
3457
3457
|
opacity: 1,
|
|
3458
|
-
rotation:
|
|
3458
|
+
rotation: 0,
|
|
3459
3459
|
seatCount: 10,
|
|
3460
3460
|
openSpace: 0.3,
|
|
3461
3461
|
seatFill: "#ed8989",
|
|
@@ -3725,7 +3725,7 @@ export const data4 = [
|
|
|
3725
3725
|
{
|
|
3726
3726
|
status: 2,
|
|
3727
3727
|
properties: {
|
|
3728
|
-
x:
|
|
3728
|
+
x: 100,
|
|
3729
3729
|
y: 100,
|
|
3730
3730
|
id: "234243242342434",
|
|
3731
3731
|
stroke: "#347ADB", //warna border
|
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import SeatEditor from "../../features/package";
|
|
4
|
-
import { extraComponent } from "../constant";
|
|
5
4
|
import { data4 } from "../constant";
|
|
6
|
-
import { dummyImage } from "../only-view/page";
|
|
7
5
|
export default function NewBoard() {
|
|
8
6
|
const [initialValue, setInitialValue] = useState([]);
|
|
9
|
-
const [extraComponents, setExtraComponents] = useState(
|
|
7
|
+
const [extraComponents, setExtraComponents] = useState([]);
|
|
10
8
|
const [backgroundColor, setBackgroundColor] = useState("#000000");
|
|
11
|
-
const [viewOnly, setViewOnly] = useState(
|
|
9
|
+
const [viewOnly, setViewOnly] = useState(false);
|
|
12
10
|
useEffect(() => {
|
|
13
11
|
setInitialValue(data4);
|
|
14
|
-
setExtraComponents(
|
|
12
|
+
setExtraComponents([]);
|
|
15
13
|
}, []);
|
|
16
14
|
return (<>
|
|
17
15
|
<div className="w-full h-screen flex flex-col relative justify-center">
|
|
18
16
|
<div className="w-full h-[1000px] bg-white border-r border-gray-200">
|
|
19
|
-
|
|
20
|
-
componentProps={initialValue}
|
|
21
|
-
mappingKey="properties"
|
|
22
|
-
extraComponentProps={[]}
|
|
23
|
-
defaultBackground="#ffffff"
|
|
24
|
-
// dragOnly={true}
|
|
25
|
-
statusKey="status"
|
|
26
|
-
|
|
27
|
-
/> */}
|
|
17
|
+
|
|
28
18
|
</div>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
>
|
|
32
|
-
{viewOnly ? "Edit Mode" : "View Mode"}
|
|
33
|
-
</button> */}
|
|
19
|
+
<button className="bg-blue-500 text-white px-4 py-2 rounded" onClick={() => setViewOnly(!viewOnly)}>
|
|
20
|
+
{viewOnly ? "Edit Mode ddd" : "View Mode"}
|
|
21
|
+
</button>
|
|
34
22
|
<div className="flex-1 h-full">
|
|
35
|
-
<SeatEditor componentProps={initialValue} viewOnly={
|
|
23
|
+
<SeatEditor componentProps={initialValue} viewOnly={viewOnly} dragOnly={true} deleteAutorized={{
|
|
36
24
|
component: true,
|
|
37
25
|
extraComponent: true,
|
|
38
26
|
}}
|
|
@@ -6,7 +6,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
6
6
|
const hasPoints = selectionLines && !isEmpty(selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.points);
|
|
7
7
|
const renderShape = (item) => {
|
|
8
8
|
var _a, _b, _c, _d, _e, _f;
|
|
9
|
-
const { id, x, y, width, height, fill, opacity, rotation = 0, shape, text, stroke, strokeWidth, labels, fontSize, fontColor, label, seatFill, src, points, seatPositions, radius, } = item;
|
|
9
|
+
const { id, x, y, width, height, fill, opacity, rotation = 0, shape, text, stroke, strokeWidth, labels, fontSize, fontColor, label, seatFill, src, points, seatPositions, radius = 10, } = item;
|
|
10
10
|
const commonProps = {
|
|
11
11
|
fill,
|
|
12
12
|
opacity,
|
|
@@ -440,7 +440,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
440
440
|
const spacingWidth = availableWidth / seatCountTopBottom;
|
|
441
441
|
const spacingHeight = availableHeight / seatCountLeftRight;
|
|
442
442
|
const topSeats = distributeWithSpacing({
|
|
443
|
-
start:
|
|
443
|
+
start: x,
|
|
444
444
|
length: width,
|
|
445
445
|
count: top,
|
|
446
446
|
radius: seatRadius,
|
|
@@ -453,7 +453,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
453
453
|
id: "top",
|
|
454
454
|
}));
|
|
455
455
|
const bottomSeats = distributeWithSpacing({
|
|
456
|
-
start:
|
|
456
|
+
start: x,
|
|
457
457
|
length: width,
|
|
458
458
|
count: bottom,
|
|
459
459
|
radius: seatRadius,
|
|
@@ -472,7 +472,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
472
472
|
radius: seatRadius,
|
|
473
473
|
spacing: spacingHeight,
|
|
474
474
|
}).map((cy) => ({
|
|
475
|
-
x: -seatSizeLR.w,
|
|
475
|
+
x: x - seatSizeLR.w,
|
|
476
476
|
y: y + cy - seatSizeLR.h / 2,
|
|
477
477
|
width: seatSizeLR.w,
|
|
478
478
|
height: seatSizeLR.h,
|
|
@@ -485,7 +485,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
485
485
|
radius: seatRadius,
|
|
486
486
|
spacing: spacingHeight,
|
|
487
487
|
}).map((cy) => ({
|
|
488
|
-
x: width,
|
|
488
|
+
x: x + width,
|
|
489
489
|
y: y + cy - seatSizeLR.h / 2,
|
|
490
490
|
width: seatSizeLR.w,
|
|
491
491
|
height: seatSizeLR.h,
|
|
@@ -111,7 +111,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
|
|
|
111
111
|
}
|
|
112
112
|
return null;
|
|
113
113
|
});
|
|
114
|
-
return <g key={`group-${tagIndex}`}>{elements}</g>;
|
|
114
|
+
return <g key={`group-${tagIndex}`} pointerEvents="none">{elements}</g>;
|
|
115
115
|
});
|
|
116
116
|
};
|
|
117
117
|
let commonProps = {
|
|
@@ -243,12 +243,12 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
|
|
|
243
243
|
{...omit(item, ["x", "y", "label", "points"])} {...commonProps}/>
|
|
244
244
|
|
|
245
245
|
{renderTags(tags)}
|
|
246
|
-
{!iconTags && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
|
|
246
|
+
{!iconTags && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`} pointerEvents="none">
|
|
247
247
|
{labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
248
248
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
249
249
|
const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
|
|
250
250
|
const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
|
|
251
|
-
return (<text {...omit(commonProps, [
|
|
251
|
+
return (<text pointerEvents="none" {...omit(commonProps, [
|
|
252
252
|
"opacity",
|
|
253
253
|
"stroke",
|
|
254
254
|
"strokeWidth",
|
|
@@ -18,6 +18,21 @@ const boardSlice = createSlice({
|
|
|
18
18
|
state.updateBy = action.payload;
|
|
19
19
|
},
|
|
20
20
|
addComponent: (state, action) => {
|
|
21
|
+
const currentPointer = state.pointer;
|
|
22
|
+
const totalHistory = state.historyChanges.length;
|
|
23
|
+
if (currentPointer < totalHistory) {
|
|
24
|
+
state.historyChanges = state.historyChanges.slice(0, currentPointer + 1);
|
|
25
|
+
}
|
|
26
|
+
const component = state.components;
|
|
27
|
+
const extraComponent = state.extraComponents;
|
|
28
|
+
state.historyChanges.push({
|
|
29
|
+
component,
|
|
30
|
+
extraComponent
|
|
31
|
+
});
|
|
32
|
+
if (state.historyChanges.length > MAX_HISTORY_CHANGES) {
|
|
33
|
+
state.historyChanges.shift();
|
|
34
|
+
}
|
|
35
|
+
state.pointer += 1;
|
|
21
36
|
state.components.push(action.payload);
|
|
22
37
|
},
|
|
23
38
|
removeComponent: (state, action) => {
|
|
@@ -43,14 +58,47 @@ const boardSlice = createSlice({
|
|
|
43
58
|
state.extraComponents[indexExtra] = Object.assign(Object.assign({}, state.extraComponents[indexExtra]), action.payload);
|
|
44
59
|
}
|
|
45
60
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
updateComponentsBulk: (state, action) => {
|
|
62
|
+
const updates = action.payload; // array of components
|
|
63
|
+
// Simpan snapshot untuk undo (deep clone lebih aman)
|
|
64
|
+
state.historyChanges.push({
|
|
65
|
+
components: [...state.components],
|
|
66
|
+
extraComponents: [...state.extraComponents],
|
|
67
|
+
});
|
|
68
|
+
if (state.historyChanges.length > MAX_HISTORY_CHANGES) {
|
|
69
|
+
state.historyChanges.shift();
|
|
70
|
+
}
|
|
71
|
+
state.pointer += 1;
|
|
72
|
+
updates.forEach((update) => {
|
|
73
|
+
const index = state.components.findIndex((component) => component.id === update.id);
|
|
74
|
+
const indexExtra = state.extraComponents.findIndex((extra) => extra.id === update.id);
|
|
75
|
+
if (index !== -1) {
|
|
76
|
+
state.components[index] = Object.assign(Object.assign({}, state.components[index]), update);
|
|
77
|
+
}
|
|
78
|
+
else if (indexExtra !== -1) {
|
|
79
|
+
state.extraComponents[indexExtra] = Object.assign(Object.assign({}, state.extraComponents[indexExtra]), update);
|
|
51
80
|
}
|
|
52
81
|
});
|
|
53
82
|
},
|
|
83
|
+
// updateAllComponents: (state, action) => {
|
|
84
|
+
// const allComponents = action.payload;
|
|
85
|
+
// forEach(allComponents, (component) => {
|
|
86
|
+
// const index = state.components.findIndex(
|
|
87
|
+
// (c) => c.id === component.id
|
|
88
|
+
// );
|
|
89
|
+
// if (index !== -1) {
|
|
90
|
+
// state.components[index] = {
|
|
91
|
+
// ...state.components[index],
|
|
92
|
+
// ...component,
|
|
93
|
+
// };
|
|
94
|
+
// }
|
|
95
|
+
// });
|
|
96
|
+
// state.historyChanges.push(state.components);
|
|
97
|
+
// if (state.historyChanges.length > MAX_HISTORY_CHANGES) {
|
|
98
|
+
// state.historyChanges.shift();
|
|
99
|
+
// }
|
|
100
|
+
// state.pointer += 1
|
|
101
|
+
// },
|
|
54
102
|
setBackgroundColor: (state, action) => {
|
|
55
103
|
state.backgroundColor = action.payload;
|
|
56
104
|
},
|
|
@@ -61,7 +109,10 @@ const boardSlice = createSlice({
|
|
|
61
109
|
state.historyChanges = state.historyChanges.slice(0, currentPointer + 1);
|
|
62
110
|
}
|
|
63
111
|
state.components = action.payload;
|
|
64
|
-
state.historyChanges.push(
|
|
112
|
+
state.historyChanges.push({
|
|
113
|
+
components: [...state.components],
|
|
114
|
+
extraComponents: [...state.extraComponents],
|
|
115
|
+
});
|
|
65
116
|
if (state.historyChanges.length > MAX_HISTORY_CHANGES) {
|
|
66
117
|
state.historyChanges.shift();
|
|
67
118
|
}
|
|
@@ -71,12 +122,28 @@ const boardSlice = createSlice({
|
|
|
71
122
|
state.extraComponents = action.payload;
|
|
72
123
|
},
|
|
73
124
|
setExtraComponent: (state, action) => {
|
|
125
|
+
const currentPointer = state.pointer;
|
|
126
|
+
const totalHistory = state.historyChanges.length;
|
|
127
|
+
if (currentPointer < totalHistory) {
|
|
128
|
+
state.historyChanges = state.historyChanges.slice(0, currentPointer + 1);
|
|
129
|
+
}
|
|
130
|
+
const component = state.components;
|
|
131
|
+
const extraComponent = state.extraComponents;
|
|
132
|
+
state.historyChanges.push({
|
|
133
|
+
components: [...component],
|
|
134
|
+
extraComponents: [...extraComponent],
|
|
135
|
+
});
|
|
136
|
+
if (state.historyChanges.length > MAX_HISTORY_CHANGES) {
|
|
137
|
+
state.historyChanges.shift();
|
|
138
|
+
}
|
|
139
|
+
state.pointer += 1;
|
|
74
140
|
state.extraComponents.push(action.payload);
|
|
75
141
|
},
|
|
76
142
|
setFlagChange: (state, action) => {
|
|
77
143
|
state.flagChange = action.payload;
|
|
78
144
|
},
|
|
79
145
|
undoHistory: (state) => {
|
|
146
|
+
var _a, _b, _c, _d;
|
|
80
147
|
if (state.pointer > 1) {
|
|
81
148
|
const lengthHistory = state.historyChanges.length;
|
|
82
149
|
if (lengthHistory === state.pointer) {
|
|
@@ -86,17 +153,20 @@ const boardSlice = createSlice({
|
|
|
86
153
|
state.pointer -= 1;
|
|
87
154
|
}
|
|
88
155
|
const prev = state.historyChanges[state.pointer];
|
|
89
|
-
state.components = current(prev);
|
|
156
|
+
state.components = current(prev === null || prev === void 0 ? void 0 : prev.components);
|
|
157
|
+
state.extraComponents = current(prev === null || prev === void 0 ? void 0 : prev.extraComponents);
|
|
90
158
|
}
|
|
91
159
|
else if (state.pointer === 1) {
|
|
92
|
-
state.components = current(state.historyChanges[0]);
|
|
160
|
+
state.components = current((_b = (_a = state.historyChanges) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.components);
|
|
161
|
+
state.components = current((_d = (_c = state.historyChanges) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.extraComponents);
|
|
93
162
|
state.pointer = 0;
|
|
94
163
|
}
|
|
95
164
|
},
|
|
96
165
|
redoHistory: (state) => {
|
|
97
166
|
if (state.pointer < state.historyChanges.length - 1) {
|
|
98
167
|
const next = state.historyChanges[state.pointer + 1];
|
|
99
|
-
state.components = current(next);
|
|
168
|
+
state.components = current(next === null || next === void 0 ? void 0 : next.components);
|
|
169
|
+
state.extraComponents = current(next === null || next === void 0 ? void 0 : next.extraComponents);
|
|
100
170
|
state.pointer += 1;
|
|
101
171
|
}
|
|
102
172
|
},
|
|
@@ -146,8 +146,14 @@ const BoardTemplate = ({ refs }) => {
|
|
|
146
146
|
}
|
|
147
147
|
if ((extraComponentsProps === null || extraComponentsProps === void 0 ? void 0 : extraComponentsProps.length) < 1 &&
|
|
148
148
|
["background", "text"].includes((_g = componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps[0]) === null || _g === void 0 ? void 0 : _g.shape)) {
|
|
149
|
-
minX = minX
|
|
150
|
-
minY = minY
|
|
149
|
+
minX = minX;
|
|
150
|
+
minY = minY;
|
|
151
|
+
}
|
|
152
|
+
const hasBoundingBox = extraComponentsProps === null || extraComponentsProps === void 0 ? void 0 : extraComponentsProps.some((item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.shape) === null || _a === void 0 ? void 0 : _a.includes("bounding-box"); });
|
|
153
|
+
if (hasBoundingBox) {
|
|
154
|
+
const findBoundingBox = extraComponentsProps.find((item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.shape) === null || _a === void 0 ? void 0 : _a.includes("bounding-box"); });
|
|
155
|
+
minX = findBoundingBox.x;
|
|
156
|
+
minY = findBoundingBox.y;
|
|
151
157
|
}
|
|
152
158
|
if ((minX !== Infinity || minY !== Infinity) && !activeTool) {
|
|
153
159
|
(_h = transformRef.current) === null || _h === void 0 ? void 0 : _h.setTransform(-minX, -minY, scale);
|
|
@@ -156,7 +162,7 @@ const BoardTemplate = ({ refs }) => {
|
|
|
156
162
|
}, [componentsProps, extraComponentsProps]);
|
|
157
163
|
const queueUpdateComponents = (data) => {
|
|
158
164
|
dispatch({
|
|
159
|
-
type: "board/
|
|
165
|
+
type: "board/updateComponentsBulk",
|
|
160
166
|
payload: data,
|
|
161
167
|
});
|
|
162
168
|
};
|
|
@@ -202,29 +208,31 @@ const BoardTemplate = ({ refs }) => {
|
|
|
202
208
|
const updatedExtra = updateSingleComponent(extraComponentsState, component, setExtraComponentsState);
|
|
203
209
|
if (updatedExtra) {
|
|
204
210
|
dispatch({ type: "board/setUpdateBy", payload: "local" });
|
|
205
|
-
|
|
206
|
-
debouncedSyncExtraComponents.current(updatedExtra);
|
|
211
|
+
queueUpdateComponents(updatedComponents);
|
|
207
212
|
}
|
|
208
213
|
};
|
|
209
214
|
const updateComponentsAttribute = (components) => {
|
|
210
215
|
if (!components.length)
|
|
211
216
|
return;
|
|
212
|
-
const isExtra = components
|
|
213
|
-
if (isExtra) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
// const isExtra = components?.filter((item) => item?.shape === "polygon");
|
|
218
|
+
// if (isExtra) {
|
|
219
|
+
// const nextExtra = updateManyComponents(
|
|
220
|
+
// extraComponentsState,
|
|
221
|
+
// components,
|
|
222
|
+
// setExtraComponentsState
|
|
223
|
+
// );
|
|
224
|
+
// dispatch({ type: "board/setUpdateBy", payload: "local" });
|
|
225
|
+
// queueUpdateComponents(nextExtra);
|
|
226
|
+
// }
|
|
218
227
|
const nextComponents = updateManyComponents(componentsState, components, setComponentsState);
|
|
219
228
|
dispatch({ type: "board/setUpdateBy", payload: "local" });
|
|
220
|
-
queueUpdateExtraComponents(nextComponents);
|
|
229
|
+
// queueUpdateExtraComponents(nextComponents);
|
|
221
230
|
};
|
|
222
231
|
const addComponents = (component) => {
|
|
223
232
|
const index = extraComponentsState.findIndex((c) => (c === null || c === void 0 ? void 0 : c.shape) === "bounding-box");
|
|
224
233
|
const nextExtraComponents = index !== -1
|
|
225
234
|
? extraComponentsState.map((item, i) => i === index ? component : item)
|
|
226
235
|
: [...extraComponentsState, component];
|
|
227
|
-
console.log({ nextExtraComponents });
|
|
228
236
|
setExtraComponentsState(nextExtraComponents);
|
|
229
237
|
dispatch({
|
|
230
238
|
type: "board/setNewExtraComponents",
|
|
@@ -282,8 +290,44 @@ const BoardTemplate = ({ refs }) => {
|
|
|
282
290
|
dispatch({ type: "panel/setShow", payload: false });
|
|
283
291
|
dataElementSelectionGroupRef.current = [];
|
|
284
292
|
};
|
|
293
|
+
const stillHoldShift = useRef(false);
|
|
294
|
+
useEffect(() => {
|
|
295
|
+
var _a, _b;
|
|
296
|
+
if (stillHoldShift.current && dataElementSelectionGroupRef.current) {
|
|
297
|
+
const selectionLines = (_a = svgRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("#selection-lines");
|
|
298
|
+
selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.setAttribute("pointer-events", "none");
|
|
299
|
+
}
|
|
300
|
+
if (!stillHoldShift.current && dataElementSelectionGroupRef.current) {
|
|
301
|
+
const selectionLines = (_b = svgRef.current) === null || _b === void 0 ? void 0 : _b.querySelector("#selection-lines");
|
|
302
|
+
selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.setAttribute("pointer-events", "all");
|
|
303
|
+
}
|
|
304
|
+
}, [stillHoldShift.current, dataElementSelectionGroupRef.current]);
|
|
305
|
+
useEffect(() => {
|
|
306
|
+
const handleKeyDown = (e) => {
|
|
307
|
+
var _a, _b;
|
|
308
|
+
// setPressedKey(e.key);
|
|
309
|
+
const selectionLines = (_a = svgRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("#selection-lines");
|
|
310
|
+
(_b = svgRef.current) === null || _b === void 0 ? void 0 : _b.querySelector("#selection-lines");
|
|
311
|
+
if (e.key === "Shift") {
|
|
312
|
+
stillHoldShift.current = true;
|
|
313
|
+
selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.setAttribute("pointer-events", "none");
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
const handleKeyUp = () => {
|
|
317
|
+
var _a;
|
|
318
|
+
const selectionLines = (_a = svgRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("#selection-lines");
|
|
319
|
+
stillHoldShift.current = false;
|
|
320
|
+
selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.setAttribute("pointer-events", "all");
|
|
321
|
+
};
|
|
322
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
323
|
+
window.addEventListener("keyup", handleKeyUp);
|
|
324
|
+
return () => {
|
|
325
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
326
|
+
window.removeEventListener("keyup", handleKeyUp);
|
|
327
|
+
};
|
|
328
|
+
}, [dataElementSelectionGroupRef.current]);
|
|
285
329
|
const handlePointerDown = (e) => {
|
|
286
|
-
var _a, _b, _c, _d, _e, _f;
|
|
330
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
287
331
|
const shiftActive = e.shiftKey;
|
|
288
332
|
const svg = svgRef.current;
|
|
289
333
|
if (!e.isPrimary)
|
|
@@ -333,6 +377,7 @@ const BoardTemplate = ({ refs }) => {
|
|
|
333
377
|
if (targetRotate) {
|
|
334
378
|
isRotatingRef.current = true;
|
|
335
379
|
}
|
|
380
|
+
const targetSelectionBox = e.target.closest("g[id='selection-lines']");
|
|
336
381
|
// RESIZE
|
|
337
382
|
const targetGroup = e.target.closest("g[data-id]");
|
|
338
383
|
const targetPointPolygon = e.target.closest("circle[data-point]");
|
|
@@ -346,8 +391,16 @@ const BoardTemplate = ({ refs }) => {
|
|
|
346
391
|
const { g } = getAttributeElement(svg, activeId);
|
|
347
392
|
if (targetGroup && shiftActive) {
|
|
348
393
|
const findById = [...componentsState, ...extraComponentsState].find((comp) => comp.id == activeId);
|
|
349
|
-
const
|
|
350
|
-
|
|
394
|
+
const currentSelection = (_e = dataElementSelectionGroupRef.current) !== null && _e !== void 0 ? _e : [];
|
|
395
|
+
const alreadySelected = currentSelection.some((comp) => comp.id == activeId);
|
|
396
|
+
let newSelection;
|
|
397
|
+
if (alreadySelected) {
|
|
398
|
+
newSelection = currentSelection.filter((comp) => comp.id != activeId);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
newSelection = [...currentSelection, findById];
|
|
402
|
+
}
|
|
403
|
+
dataElementSelectionGroupRef.current = newSelection;
|
|
351
404
|
}
|
|
352
405
|
const box = getGlobalBBox(svg, g);
|
|
353
406
|
const { x: initialXG, y: initialYG } = getTranslate(g);
|
|
@@ -356,7 +409,7 @@ const BoardTemplate = ({ refs }) => {
|
|
|
356
409
|
const hitPoint = document.elementFromPoint(clientX, clientY);
|
|
357
410
|
// CHECK FOR HIT ON SVG FOR SELECTION BOX
|
|
358
411
|
// MAKE AND UNMAKE SELECTION BOX START ------
|
|
359
|
-
const hadSelectionBox = ((
|
|
412
|
+
const hadSelectionBox = ((_f = dataElementSelectionGroupRef.current) === null || _f === void 0 ? void 0 : _f.length) > 0 && !isSingleSelection;
|
|
360
413
|
const downInSelectionBox = hadSelectionBox && (hitPoint === null || hitPoint === void 0 ? void 0 : hitPoint.nodeName) !== "svg";
|
|
361
414
|
const downOutSelectionBox = hadSelectionBox && (hitPoint === null || hitPoint === void 0 ? void 0 : hitPoint.nodeName) === "svg";
|
|
362
415
|
const downBeforeHasSelectionBox = !downInSelectionBox &&
|
|
@@ -369,7 +422,6 @@ const BoardTemplate = ({ refs }) => {
|
|
|
369
422
|
}
|
|
370
423
|
//move tanpa ada selection single element dan bisa move juga ketika ada selection box
|
|
371
424
|
//JIKA PUNYA SELECTION TAPI DOWN DI ELEMENT LAIN
|
|
372
|
-
const downInMatchSelectionBox = downInSelectionBox && (hitPoint === null || hitPoint === void 0 ? void 0 : hitPoint.nodeName) !== "svg" && isInSelectionTarget;
|
|
373
425
|
if (downInSelectionBox) {
|
|
374
426
|
hadSelectionRef.current = true;
|
|
375
427
|
}
|
|
@@ -394,7 +446,7 @@ const BoardTemplate = ({ refs }) => {
|
|
|
394
446
|
shape: nameShapeSelectionBoxGhost,
|
|
395
447
|
id: idSelectionBoxGhost,
|
|
396
448
|
});
|
|
397
|
-
(
|
|
449
|
+
(_g = svgRef.current) === null || _g === void 0 ? void 0 : _g.appendChild(boxSelection);
|
|
398
450
|
}
|
|
399
451
|
// MAKE AND UNMAKE SELECTION BOX END ------
|
|
400
452
|
// RESIZE SELECTION BOX
|
|
@@ -407,17 +459,23 @@ const BoardTemplate = ({ refs }) => {
|
|
|
407
459
|
!downOutSelectionBox &&
|
|
408
460
|
isInSelectionTarget &&
|
|
409
461
|
!isSingleSelection &&
|
|
410
|
-
!isInTargetElement
|
|
411
|
-
|
|
462
|
+
!isInTargetElement &&
|
|
463
|
+
!isInitialCreateBoundingBox;
|
|
464
|
+
const downAtResizePositionAndHasSelectionBox = downAtResizePosition &&
|
|
465
|
+
hadSelectionBox &&
|
|
466
|
+
!isRotateSelectionBox &&
|
|
467
|
+
!isInitialCreateBoundingBox;
|
|
412
468
|
const isMightResizeElement = !isEmpty(selectedComponent) &&
|
|
413
469
|
downAtResizePosition &&
|
|
414
470
|
downAtResizePosition &&
|
|
415
|
-
!hadSelectionBox
|
|
471
|
+
!hadSelectionBox &&
|
|
472
|
+
!isInitialCreateBoundingBox;
|
|
416
473
|
const isMightMove = activeId &&
|
|
417
474
|
!targetPointPolygon &&
|
|
418
475
|
isInTargetElement &&
|
|
419
|
-
!isMightResizeElement
|
|
420
|
-
|
|
476
|
+
!isMightResizeElement &&
|
|
477
|
+
!isInitialCreateBoundingBox;
|
|
478
|
+
const isMightMoveOneElementSelection = isSingleSelection && !isMightResizeElement && !isInitialCreateBoundingBox;
|
|
421
479
|
if (downOutResizePositionAndInSelectionBox) {
|
|
422
480
|
onMoveSelectionBoxRef.current = true;
|
|
423
481
|
}
|
|
@@ -34,6 +34,12 @@ export interface TableEditorProps {
|
|
|
34
34
|
extraComponent: boolean;
|
|
35
35
|
};
|
|
36
36
|
refs?: React.RefObject<RefsType>;
|
|
37
|
+
viewStyles?: {
|
|
38
|
+
paddingTop?: number;
|
|
39
|
+
paddingLeft?: number;
|
|
40
|
+
paddingRight?: number;
|
|
41
|
+
paddingBottom?: number;
|
|
42
|
+
};
|
|
37
43
|
}
|
|
38
44
|
declare const TableEditor: (props: TableEditorProps) => import("react").JSX.Element;
|
|
39
45
|
export default TableEditor;
|
|
@@ -8,7 +8,7 @@ import { isEqual } from "lodash";
|
|
|
8
8
|
import LayerView from "../view-only";
|
|
9
9
|
const TableEditor = (props) => {
|
|
10
10
|
const [initialValue, setInitialValue] = useState(null);
|
|
11
|
-
const { componentProps, extraComponentProps, onCurrentStateChange, dragOnly, mappingKey, viewOnly, deleteAutorized, refs } = props;
|
|
11
|
+
const { componentProps, extraComponentProps, onCurrentStateChange, dragOnly, mappingKey, viewOnly, deleteAutorized, refs, } = props;
|
|
12
12
|
const { components, extraComponents, backgroundColor } = useAppSelector((state) => state.board);
|
|
13
13
|
const dispatch = useAppDispatch();
|
|
14
14
|
const refsBoard = useRef(null);
|
|
@@ -17,7 +17,7 @@ const TableEditor = (props) => {
|
|
|
17
17
|
return ({
|
|
18
18
|
svgRef: (_a = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _a === void 0 ? void 0 : _a.svgRef,
|
|
19
19
|
transformRef: (_b = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _b === void 0 ? void 0 : _b.transformRef,
|
|
20
|
-
containerRef: (_c = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _c === void 0 ? void 0 : _c.containerRef
|
|
20
|
+
containerRef: (_c = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _c === void 0 ? void 0 : _c.containerRef,
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
useEffect(() => {
|
|
@@ -27,6 +27,13 @@ const TableEditor = (props) => {
|
|
|
27
27
|
payload: null,
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
dispatch({
|
|
31
|
+
type: "tool/setActiveTool",
|
|
32
|
+
payload: ""
|
|
33
|
+
});
|
|
34
|
+
if (viewOnly) {
|
|
35
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
36
|
+
}
|
|
30
37
|
}, [viewOnly]);
|
|
31
38
|
const onUpdateCurrentState = () => {
|
|
32
39
|
let matchInitialValueWithComponents = initialValue === null || initialValue === void 0 ? void 0 : initialValue.map((item) => {
|
|
@@ -58,7 +65,8 @@ const TableEditor = (props) => {
|
|
|
58
65
|
};
|
|
59
66
|
useEffect(() => {
|
|
60
67
|
if (!isEqual(components, convertComponentProps()) ||
|
|
61
|
-
!isEqual(extraComponents, extraComponentProps) ||
|
|
68
|
+
!isEqual(extraComponents, extraComponentProps) ||
|
|
69
|
+
!isEqual(backgroundColor, props === null || props === void 0 ? void 0 : props.defaultBackground)) {
|
|
62
70
|
onCurrentStateChange && onUpdateCurrentState();
|
|
63
71
|
}
|
|
64
72
|
}, [components, extraComponents, backgroundColor]);
|
|
@@ -105,18 +113,13 @@ const TableEditor = (props) => {
|
|
|
105
113
|
}, [componentProps, extraComponentProps, props === null || props === void 0 ? void 0 : props.defaultBackground]);
|
|
106
114
|
return (<>
|
|
107
115
|
<div className="w-full h-screen flex relative">
|
|
108
|
-
<div className="w-full h-full flex relative"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}}>
|
|
116
|
-
<SideTool dragOnly={dragOnly} deleteAutorized={deleteAutorized}/>
|
|
117
|
-
<Board refs={refsBoard}/>
|
|
118
|
-
<ControlPanels action={props.action} responseMapping={props.responseMapping}/>
|
|
119
|
-
</div>
|
|
116
|
+
{viewOnly ? (<div className="w-full h-full flex relative">
|
|
117
|
+
<LayerView statusKey="status"/>
|
|
118
|
+
</div>) : (<div key={`${viewOnly}`} className="w-full h-full flex relative">
|
|
119
|
+
<SideTool dragOnly={dragOnly} deleteAutorized={deleteAutorized}/>
|
|
120
|
+
<Board key={`${viewOnly}`} refs={refsBoard}/>
|
|
121
|
+
<ControlPanels action={props.action} responseMapping={props.responseMapping}/>
|
|
122
|
+
</div>)}
|
|
120
123
|
</div>
|
|
121
124
|
</>);
|
|
122
125
|
};
|
|
@@ -43,6 +43,7 @@ const ControlPanels = (props) => {
|
|
|
43
43
|
let values = Form.useWatch([], form);
|
|
44
44
|
useEffect(() => {
|
|
45
45
|
if (selectedComponent) {
|
|
46
|
+
console.log("selectedComponent", selectedComponent);
|
|
46
47
|
const isDifferentId = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) !== (values === null || values === void 0 ? void 0 : values.id) || !(values === null || values === void 0 ? void 0 : values.id);
|
|
47
48
|
const isSameIdAndSameDimensions = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) === (values === null || values === void 0 ? void 0 : values.id) &&
|
|
48
49
|
(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.height) === (values === null || values === void 0 ? void 0 : values.height) &&
|
|
@@ -55,6 +56,7 @@ const ControlPanels = (props) => {
|
|
|
55
56
|
form.setFieldsValue(selectedComponent);
|
|
56
57
|
}
|
|
57
58
|
else if (selectedGroup) {
|
|
59
|
+
console.log("selectedGroup", selectedGroup);
|
|
58
60
|
if (show)
|
|
59
61
|
setOpen(true);
|
|
60
62
|
if (!show)
|
|
@@ -74,11 +76,23 @@ const ControlPanels = (props) => {
|
|
|
74
76
|
const isSameOpacity = isSameAllByKey(selectedGroup, "opacity");
|
|
75
77
|
const isSampeRotation = isSameAllByKey(selectedGroup, "rotation");
|
|
76
78
|
const isSameStrokeWidth = isSameAllByKey(selectedGroup, "strokeWidth");
|
|
77
|
-
|
|
79
|
+
console.log({
|
|
80
|
+
isSameAllWidth,
|
|
81
|
+
isSameAllHeight,
|
|
82
|
+
isSameX,
|
|
83
|
+
isSameY,
|
|
84
|
+
isSameFill,
|
|
85
|
+
isSameStroke,
|
|
86
|
+
isSameOpacity,
|
|
87
|
+
isSampeRotation,
|
|
88
|
+
isSameStrokeWidth,
|
|
89
|
+
});
|
|
90
|
+
form.setFieldsValue(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (isSameAllWidth ? { width: selectedGroup[0].width } : undefined)), (isSameAllHeight ? { height: selectedGroup[0].height } : undefined)), (isSameX ? { x: selectedGroup[0].x } : undefined)), (isSameY ? { y: selectedGroup[0].y } : undefined)), (isSameFill ? { fill: selectedGroup[0].fill } : undefined)), (isSameStroke ? { stroke: selectedGroup[0].stroke } : undefined)), (isSameOpacity ? { opacity: selectedGroup[0].opacity } : undefined)), (isSampeRotation ? { rotation: selectedGroup[0].rotation } : undefined)), (isSameStrokeWidth
|
|
78
91
|
? { strokeWidth: selectedGroup[0].strokeWidth }
|
|
79
92
|
: {})));
|
|
80
93
|
}
|
|
81
94
|
else {
|
|
95
|
+
console.log("selectedGroup", selectedGroup);
|
|
82
96
|
setOpen(false);
|
|
83
97
|
}
|
|
84
98
|
}, [selectedComponent, selectedGroup, show]);
|
|
@@ -129,6 +143,8 @@ const ControlPanels = (props) => {
|
|
|
129
143
|
type: "board/updateAllComponents",
|
|
130
144
|
payload: data,
|
|
131
145
|
});
|
|
146
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
147
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
132
148
|
}, 300));
|
|
133
149
|
const debouncedSyncForm = useRef(debounce(() => {
|
|
134
150
|
dispatch({ type: "board/setFlagChange", payload: true });
|
|
@@ -147,11 +163,12 @@ const ControlPanels = (props) => {
|
|
|
147
163
|
const newElement = Object.assign(Object.assign(Object.assign({}, findElement), values), { x: (_a = values.x) !== null && _a !== void 0 ? _a : findElement.x, y: (_b = values.y) !== null && _b !== void 0 ? _b : findElement.y, width: isAdjustSize ? forceSize.width : (_c = values.width) !== null && _c !== void 0 ? _c : findElement.width, height: isAdjustSize
|
|
148
164
|
? forceSize.height
|
|
149
165
|
: (_d = values.height) !== null && _d !== void 0 ? _d : findElement.height });
|
|
150
|
-
const
|
|
166
|
+
const svg = (_f = (_e = svgRef === null || svgRef === void 0 ? void 0 : svgRef.current) === null || _e === void 0 ? void 0 : _e[1]) !== null && _f !== void 0 ? _f : (_g = svgRef === null || svgRef === void 0 ? void 0 : svgRef.current) === null || _g === void 0 ? void 0 : _g[0];
|
|
167
|
+
const { g, element } = getAttributeElement(svg, id);
|
|
151
168
|
applyResizeToSvgElement(element, g, newElement);
|
|
152
|
-
const getBBox = getGlobalBBox(
|
|
169
|
+
const getBBox = getGlobalBBox(svg, g);
|
|
153
170
|
debouncedSyncSelectedSelectionLines.current(Object.assign({}, getBBox));
|
|
154
|
-
updateSelectionBox(
|
|
171
|
+
updateSelectionBox(svg, getBBox);
|
|
155
172
|
};
|
|
156
173
|
const handleChangeComponent = (values, allValues) => {
|
|
157
174
|
const { shape } = allValues, restProps = __rest(allValues, ["shape"]);
|
|
@@ -159,10 +176,6 @@ const ControlPanels = (props) => {
|
|
|
159
176
|
if (selectedComponent) {
|
|
160
177
|
updateElement(allValues.id, values);
|
|
161
178
|
debouncedSyncComponents.current(Object.assign(Object.assign({}, (selectedComponent || {})), newValues));
|
|
162
|
-
// debouncedSyncSelectedComponents.current({
|
|
163
|
-
// ...(selectedComponent || {}),
|
|
164
|
-
// ...newValues,
|
|
165
|
-
// });
|
|
166
179
|
}
|
|
167
180
|
if ((selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.length) > 0) {
|
|
168
181
|
const { width, height, x, y, fill, stroke, opacity, rotation, strokeWidth, } = newValues;
|
|
@@ -74,6 +74,8 @@ const UploadTool = ({ name, type, action, responseMapping, defaultValue, }) => {
|
|
|
74
74
|
payload: Object.assign({}, defaultFormatValue(width, height, srcFromResponse, Number(defaultValue.id))),
|
|
75
75
|
});
|
|
76
76
|
setDefaultSrc(img.src);
|
|
77
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
78
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
77
79
|
}
|
|
78
80
|
else {
|
|
79
81
|
dispatch({
|
|
@@ -84,6 +86,7 @@ const UploadTool = ({ name, type, action, responseMapping, defaultValue, }) => {
|
|
|
84
86
|
});
|
|
85
87
|
}
|
|
86
88
|
dispatch({ type: "board/setFlagChange", payload: true });
|
|
89
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
87
90
|
// message.success(`${info.file.name} uploaded successfully.`);
|
|
88
91
|
};
|
|
89
92
|
// Set img src AFTER onload
|
|
@@ -37,7 +37,7 @@ export const getSeatPosition = (shape, props) => {
|
|
|
37
37
|
return (props === null || props === void 0 ? void 0 : props.seatPositions) || { top: 0, bottom: 0, left: 0, right: 0 };
|
|
38
38
|
};
|
|
39
39
|
export const adjustHeightWidthForSeatShape = (shape, props) => {
|
|
40
|
-
if (shape.includes("circle")) {
|
|
40
|
+
if (shape === null || shape === void 0 ? void 0 : shape.includes("circle")) {
|
|
41
41
|
const sizeDefault = Math.min(props.width, props.height);
|
|
42
42
|
return Object.assign(Object.assign({}, props), { height: sizeDefault, width: sizeDefault });
|
|
43
43
|
}
|
|
@@ -71,8 +71,10 @@ export interface LayerViewProps<TMeta = undefined> {
|
|
|
71
71
|
onSwitch?: (e: MouseEvent, component: TypeActionProps<TMeta>) => void;
|
|
72
72
|
refs?: React.ForwardedRef<RefLayerView>;
|
|
73
73
|
viewStyles?: {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
paddingTop?: number;
|
|
75
|
+
paddingLeft?: number;
|
|
76
|
+
paddingRight?: number;
|
|
77
|
+
paddingBottom?: number;
|
|
76
78
|
};
|
|
77
79
|
}
|
|
78
80
|
declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => React.JSX.Element;
|
|
@@ -163,10 +163,12 @@ const LayerView = (props) => {
|
|
|
163
163
|
minY = minY;
|
|
164
164
|
}
|
|
165
165
|
const hasBoundingBox = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.some((item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.shape) === null || _a === void 0 ? void 0 : _a.includes("bounding-box"); });
|
|
166
|
-
const paddingY =
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
// const paddingY =
|
|
167
|
+
// maxY * (props?.viewStyles?.paddingY || 0) +
|
|
168
|
+
// minY * (props?.viewStyles?.paddingY || 0);
|
|
169
|
+
// const paddingX =
|
|
170
|
+
// maxX * (props?.viewStyles?.paddingX || 0) +
|
|
171
|
+
// minX * (props?.viewStyles?.paddingX || 0);
|
|
170
172
|
if (hasBoundingBox) {
|
|
171
173
|
const findBoundingBox = extraComponentsEditor.find((item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.shape) === null || _a === void 0 ? void 0 : _a.includes("bounding-box"); });
|
|
172
174
|
hasBoundingBoxRef.current = true;
|
|
@@ -177,11 +179,17 @@ const LayerView = (props) => {
|
|
|
177
179
|
height: findBoundingBox.height,
|
|
178
180
|
};
|
|
179
181
|
}
|
|
182
|
+
// return {
|
|
183
|
+
// minX: minX - paddingX - (minX - paddingX) * 0.5,
|
|
184
|
+
// minY: minY - paddingY * 2,
|
|
185
|
+
// width: maxX + paddingX * 2,
|
|
186
|
+
// height: maxY + paddingY + (maxY + paddingY) * 0.5,
|
|
187
|
+
// };
|
|
180
188
|
return {
|
|
181
|
-
minX: minX -
|
|
182
|
-
minY: minY -
|
|
183
|
-
width: maxX +
|
|
184
|
-
height: maxY +
|
|
189
|
+
minX: minX - ((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop),
|
|
190
|
+
minY: minY - ((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingLeft),
|
|
191
|
+
width: maxX + ((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingRight),
|
|
192
|
+
height: maxY + ((_l = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _l === void 0 ? void 0 : _l.paddingBottom),
|
|
185
193
|
};
|
|
186
194
|
}, [componentsEditor, extraComponentsEditor]);
|
|
187
195
|
const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
|
|
@@ -538,11 +546,11 @@ const LayerView = (props) => {
|
|
|
538
546
|
touchAction: "none",
|
|
539
547
|
userSelect: "none",
|
|
540
548
|
}} {...props.svgProps}>
|
|
541
|
-
<defs>
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
549
|
+
{hasBoundingBox && (<defs>
|
|
550
|
+
<clipPath id="contentCrop">
|
|
551
|
+
<rect x={boundingBox.minX} y={boundingBox.minY} width={boundingBox.width} height={boundingBox.height}/>
|
|
552
|
+
</clipPath>
|
|
553
|
+
</defs>)}
|
|
546
554
|
<g id="main-layer" clip-path="url(#contentCrop)">
|
|
547
555
|
<Layers components={[
|
|
548
556
|
...extraComponentsEditor,
|