seat-editor 3.4.4 → 3.4.5

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.
@@ -347,11 +347,12 @@ export declare const data4: ({
347
347
  x: number;
348
348
  y: number;
349
349
  labels: {
350
+ label: string;
351
+ fontColor: string;
350
352
  x: number;
351
353
  y: number;
352
- label: string;
353
354
  fontSize: number;
354
- fontColor: string;
355
+ rotation: number;
355
356
  }[];
356
357
  id: string;
357
358
  stroke: string;
@@ -418,19 +419,14 @@ export declare const data4: ({
418
419
  })[];
419
420
  opacity: number;
420
421
  rotation: number;
421
- seatCount: number;
422
422
  openSpace: number;
423
423
  seatFill: string;
424
- seatPositions: {
425
- top: number;
426
- bottom: number;
427
- left: number;
428
- right: number;
429
- };
430
424
  radius?: undefined;
425
+ seatCount?: undefined;
431
426
  };
432
427
  } | {
433
428
  status: number;
429
+ capacity: number;
434
430
  properties: {
435
431
  x: number;
436
432
  y: number;
@@ -512,19 +508,19 @@ export declare const data4: ({
512
508
  offsetX?: undefined;
513
509
  offsetY?: undefined;
514
510
  })[];
515
- seatPositions: {
516
- top: number;
517
- bottom: number;
518
- left: number;
519
- right: number;
520
- };
521
511
  opacity: number;
522
512
  rotation: number;
523
- seatCount: number;
524
- labels?: undefined;
513
+ labels: {
514
+ label: string;
515
+ fontColor: string;
516
+ x: number;
517
+ y: number;
518
+ fontSize: number;
519
+ rotation: number;
520
+ }[];
521
+ seatCount?: undefined;
525
522
  };
526
523
  uuid_table?: undefined;
527
- capacity?: undefined;
528
524
  } | {
529
525
  properties: {
530
526
  x: number;
@@ -580,7 +576,6 @@ export declare const data4: ({
580
576
  seatCount: number;
581
577
  openSpace?: undefined;
582
578
  seatFill?: undefined;
583
- seatPositions?: undefined;
584
579
  radius?: undefined;
585
580
  };
586
581
  uuid_table?: undefined;
@@ -3437,7 +3437,7 @@ export const test4 = [
3437
3437
  seatCount: 0,
3438
3438
  uuid_table: "d088bba0-e990-410e-aea9-08548175a0b9",
3439
3439
  gapTags: 20,
3440
- }
3440
+ },
3441
3441
  },
3442
3442
  {
3443
3443
  status: 1,
@@ -3527,17 +3527,18 @@ export const data4 = [
3527
3527
  {
3528
3528
  uuid_table: "axxxxx",
3529
3529
  status: 0,
3530
- capacity: 5,
3530
+ capacity: 4,
3531
3531
  properties: {
3532
3532
  x: 500,
3533
3533
  y: 520,
3534
3534
  labels: [
3535
3535
  {
3536
+ label: "3",
3537
+ fontColor: "#000000",
3536
3538
  x: 0,
3537
- y: 27,
3538
- label: "New Table 5",
3539
+ y: 0,
3539
3540
  fontSize: 12,
3540
- fontColor: "#0d0c0c",
3541
+ rotation: 0,
3541
3542
  },
3542
3543
  ],
3543
3544
  id: "1761194669729132000",
@@ -3613,15 +3614,15 @@ export const data4 = [
3613
3614
  ],
3614
3615
  opacity: 1,
3615
3616
  rotation: 0,
3616
- seatCount: 10,
3617
+ // seatCount: 10,
3617
3618
  openSpace: 0.3,
3618
3619
  seatFill: "#ed8989",
3619
- seatPositions: {
3620
- top: 3,
3621
- bottom: 3,
3622
- left: 3,
3623
- right: 3,
3624
- },
3620
+ // seatPositions: {
3621
+ // top: 3,
3622
+ // bottom: 3,
3623
+ // left: 3,
3624
+ // right: 3,
3625
+ // },
3625
3626
  },
3626
3627
  },
3627
3628
  // {
@@ -3881,6 +3882,7 @@ export const data4 = [
3881
3882
  // },
3882
3883
  {
3883
3884
  status: 2,
3885
+ capacity: 4,
3884
3886
  properties: {
3885
3887
  x: 100,
3886
3888
  y: 100,
@@ -3959,15 +3961,25 @@ export const data4 = [
3959
3961
  gap: 2,
3960
3962
  },
3961
3963
  ],
3962
- seatPositions: {
3963
- top: 1,
3964
- bottom: 1,
3965
- left: 1,
3966
- right: 1,
3967
- },
3964
+ // seatPositions: {
3965
+ // top: 1,
3966
+ // bottom: 1,
3967
+ // left: 1,
3968
+ // right: 1,
3969
+ // },
3968
3970
  opacity: 1,
3969
3971
  rotation: 0,
3970
- seatCount: 6,
3972
+ labels: [
3973
+ {
3974
+ label: "3",
3975
+ fontColor: "#000000",
3976
+ x: 0,
3977
+ y: 0,
3978
+ fontSize: 12,
3979
+ rotation: 0,
3980
+ },
3981
+ ],
3982
+ // seatCount: 6,
3971
3983
  },
3972
3984
  },
3973
3985
  {
@@ -5569,7 +5581,7 @@ export const dummyExtra6 = [
5569
5581
  {
5570
5582
  x: 100,
5571
5583
  y: 100,
5572
- id: '1754137739279',
5584
+ id: "1754137739279",
5573
5585
  src: "https://cdn.table.link/prod/5bf923de-2366-4a11-9b8b-e92de0afbf05/3a65cb36-7d85-4c38-9403-a15f94641920/68d45207-d66b-4bb5-92a2-4e5a87715e98/rsvp/1754137739126863915_BOI Reg.png",
5574
5586
  fill: "red",
5575
5587
  // image:
@@ -174,7 +174,7 @@ const TouchScrollDetect = () => {
174
174
  key: "rsvp_time",
175
175
  items: ["text", "icon"],
176
176
  },
177
- ], defaultBackground: "#000000", mappingKey: "properties", componentProps: [], onDrop: (e, data) => handleDrop(e, data), onSwitch: (e, data) => handleSwitch(e, data), extraComponentProps: [], onSelectComponent: (component) => {
177
+ ], defaultBackground: "#000000", mappingKey: "properties", componentProps: [], onDoubleClick: (data) => console.log(data), onDrop: (e, data) => handleDrop(e, data), onSwitch: (e, data) => handleSwitch(e, data), extraComponentProps: [], onSelectComponent: (component) => {
178
178
  handleSelectTable(component);
179
179
  }, dragTableBlockKey: [
180
180
  {
@@ -216,8 +216,10 @@ const TouchScrollDetect = () => {
216
216
  icon: _jsx(UserIcon, {}),
217
217
  key: "user",
218
218
  },
219
- ], viewStyles: {
220
- paddingTop: 200,
221
- }, transformProps: {} })] })] })] }));
219
+ ],
220
+ // viewStyles={{
221
+ // paddingTop: 10,
222
+ // }}
223
+ transformProps: {} })] })] })] }));
222
224
  };
223
225
  export default TouchScrollDetect;
@@ -198,7 +198,7 @@ const TouchScrollDetect = () => {
198
198
  key: "rsvp_time",
199
199
  items: ["text", "icon"],
200
200
  },
201
- ]} defaultBackground="#000000" mappingKey="properties" componentProps={[]} onDrop={(e, data) => handleDrop(e, data)} onSwitch={(e, data) => handleSwitch(e, data)} extraComponentProps={[]} onSelectComponent={(component) => {
201
+ ]} defaultBackground="#000000" mappingKey="properties" componentProps={[]} onDoubleClick={(data) => console.log(data)} onDrop={(e, data) => handleDrop(e, data)} onSwitch={(e, data) => handleSwitch(e, data)} extraComponentProps={[]} onSelectComponent={(component) => {
202
202
  handleSelectTable(component);
203
203
  }} dragTableBlockKey={[
204
204
  {
@@ -240,9 +240,11 @@ const TouchScrollDetect = () => {
240
240
  icon: <UserIcon />,
241
241
  key: "user",
242
242
  },
243
- ]} viewStyles={{
244
- paddingTop: 200,
245
- }} transformProps={{}}/>
243
+ ]}
244
+ // viewStyles={{
245
+ // paddingTop: 10,
246
+ // }}
247
+ transformProps={{}}/>
246
248
  </div>
247
249
  </div>
248
250
  </div>);
@@ -1,25 +1,25 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Button, ColorPicker, Flex, Form, Input, InputNumber, Divider } from "antd";
3
+ import { Button, ColorPicker, Flex, Form, Input, InputNumber, Divider, } from "antd";
4
4
  const SectionLabel = () => {
5
- return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Section Labeling" }), _jsx(Divider, { style: { margin: 4 } }), _jsx(Form.Item, { label: "Labels in table", name: "labels", className: "w-full", children: _jsx(Form.List, { name: "labels", children: (fields, { add, remove }) => (_jsxs(_Fragment, { children: [fields.map((field) => (_jsxs("div", { className: "w-full", children: [_jsx(Flex, { gap: 5, className: "w-full flex justify-between", children: _jsx(Form.Item, { name: [field.name, "label"], label: "Text", className: "w-full", children: _jsx(Input, {}) }) }), _jsxs(Flex, { gap: 5, className: "w-full flex justify-between", children: [_jsx(Form.Item, { name: [field.name, "x"], label: "Position X", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "y"], label: "Position Y", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "rotation"], label: "Rotation", children: _jsx(InputNumber, { suffix: "\u00B0", min: 0, max: 360, parser: (value) => {
5
+ return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Section Labeling" }), _jsx(Divider, { style: { margin: 4 } }), _jsx(Form.Item, { label: "Labels in table", name: "labels", className: "w-full", children: _jsx(Form.List, { name: "labels", children: (fields, { add, remove }) => (_jsxs(_Fragment, { children: [fields.map((field) => (_jsxs("div", { className: "w-full flex-col mb-2", children: [_jsx(Flex, { gap: 5, className: "w-full flex justify-between", children: _jsx(Form.Item, { name: [field.name, "label"], label: "Text", className: "w-full", children: _jsx(Input, {}) }) }), _jsxs(Flex, { gap: 5, className: "w-full flex justify-between", children: [_jsx(Form.Item, { name: [field.name, "x"], label: "Position X", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "y"], label: "Position Y", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "rotation"], label: "Rotation", children: _jsx(InputNumber, { suffix: "\u00B0", min: 0, max: 360, parser: (value) => {
6
6
  if (!value)
7
7
  return 0;
8
8
  const num = Number(value.replace(/\D/g, ""));
9
9
  if (Number.isNaN(num))
10
10
  return 0;
11
11
  return Math.min(360, Math.max(0, num));
12
- } }) })] }), _jsxs(Flex, { gap: 5, children: [_jsx(Form.Item, { name: [field.name, "fontSize"], label: "Size", children: _jsx(InputNumber, { suffix: "px" }) }), _jsx(Form.Item, { name: [field.name, "fontColor"], label: "Color", getValueFromEvent: (color) => color.toHexString(), children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] })] }, field.key))), _jsxs(Flex, { gap: 2, className: "w-full", children: [_jsx(Button
13
- // type="dashed"
14
- , {
12
+ } }) })] }), _jsxs(Flex, { gap: 5, children: [_jsx(Form.Item, { name: [field.name, "fontSize"], label: "Size", children: _jsx(InputNumber, { suffix: "px" }) }), _jsx(Form.Item, { name: [field.name, "fontColor"], label: "Color", getValueFromEvent: (color) => color.toHexString(), children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), fields.length < 2 && (_jsx(Flex, { gap: 2, className: "w-full", children: _jsx(Button
15
13
  // type="dashed"
16
- onClick: () => remove(fields.length - 1), className: "w-full", children: "Remove" }), _jsx(Button, { type: "primary", onClick: () => add({
17
- label: "",
18
- fontColor: "#000000",
19
- x: 0,
20
- y: 0,
21
- fontSize: 12,
22
- rotation: 0
23
- }), className: "w-full", children: "Add" })] })] })) }) }), _jsx("div", { className: "divider-dashed" })] }));
14
+ , {
15
+ // type="dashed"
16
+ onClick: () => remove(fields.indexOf(field)), className: "w-full", children: "Remove" }) }))] }, field.key))), _jsx(Flex, { gap: 2, className: "w-full mt-2", children: _jsx(Button, { type: "primary", onClick: () => add({
17
+ label: "",
18
+ fontColor: "#000000",
19
+ x: 0,
20
+ y: 0,
21
+ fontSize: 12,
22
+ rotation: 0,
23
+ }), className: "w-full", children: "Add" }) })] })) }) }), _jsx("div", { className: "divider-dashed" })] }));
24
24
  };
25
25
  export default SectionLabel;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Button, ColorPicker, Flex, Form, Input, InputNumber, Divider } from "antd";
2
+ import { Button, ColorPicker, Flex, Form, Input, InputNumber, Divider, } from "antd";
3
3
  const SectionLabel = () => {
4
4
  return (<div className="py-2">
5
5
  <h1 className="heading-s">Section Labeling</h1>
@@ -8,12 +8,11 @@ const SectionLabel = () => {
8
8
  <Form.Item label="Labels in table" name={"labels"} className="w-full">
9
9
  <Form.List name="labels">
10
10
  {(fields, { add, remove }) => (<>
11
- {fields.map((field) => (<div key={field.key} className="w-full">
11
+ {fields.map((field) => (<div key={field.key} className="w-full flex-col mb-2">
12
12
  <Flex gap={5} className="w-full flex justify-between">
13
13
  <Form.Item name={[field.name, "label"]} label="Text" className="w-full">
14
14
  <Input />
15
15
  </Form.Item>
16
-
17
16
  </Flex>
18
17
  <Flex gap={5} className="w-full flex justify-between">
19
18
  <Form.Item name={[field.name, "x"]} label="Position X">
@@ -41,21 +40,29 @@ const SectionLabel = () => {
41
40
  <ColorPicker allowClear format="hex" defaultFormat="hex"/>
42
41
  </Form.Item>
43
42
  </Flex>
43
+ {fields.length < 2 && (<Flex gap={2} className="w-full">
44
+ <Button
45
+ // type="dashed"
46
+ onClick={() => remove(fields.indexOf(field))} className="w-full">
47
+ Remove
48
+ </Button>
49
+ </Flex>)}
44
50
  </div>))}
45
- <Flex gap={2} className="w-full">
46
-
47
- <Button
48
- // type="dashed"
49
- onClick={() => remove(fields.length - 1)} className="w-full">
50
- Remove
51
- </Button>
51
+ <Flex gap={2} className="w-full mt-2">
52
+ {/* <Button
53
+ // type="dashed"
54
+ onClick={() => remove(fields.length - 1)}
55
+ className="w-full"
56
+ >
57
+ Remove
58
+ </Button> */}
52
59
  <Button type="primary" onClick={() => add({
53
60
  label: "",
54
61
  fontColor: "#000000",
55
62
  x: 0,
56
63
  y: 0,
57
64
  fontSize: 12,
58
- rotation: 0
65
+ rotation: 0,
59
66
  })} className="w-full">
60
67
  Add
61
68
  </Button>
@@ -72,7 +72,7 @@ const SectionShape = ({ allowChangeShape = true, }) => {
72
72
  const num = Number(cleaned);
73
73
  if (Number.isNaN(num))
74
74
  return null;
75
- return Math.min(0, Math.max(0, num));
75
+ return Math.min(100, Math.max(0, num));
76
76
  }, suffix: "%" }) }) })] }));
77
77
  };
78
78
  export default SectionShape;
@@ -117,7 +117,7 @@ const SectionShape = ({ allowChangeShape = true, }) => {
117
117
  const num = Number(cleaned);
118
118
  if (Number.isNaN(num))
119
119
  return null;
120
- return Math.min(0, Math.max(0, num));
120
+ return Math.min(100, Math.max(0, num));
121
121
  }} suffix="%"/>
122
122
  </Form.Item>
123
123
  </Flex>
@@ -210,14 +210,14 @@ const boardSlice = createSlice({
210
210
  state.pointer -= 1;
211
211
  }
212
212
  const prev = state.historyChanges[state.pointer];
213
- state.components = current(prev === null || prev === void 0 ? void 0 : prev.components);
214
- state.extraComponents = current(prev === null || prev === void 0 ? void 0 : prev.extraComponents);
213
+ state.components = prev === null || prev === void 0 ? void 0 : prev.components;
214
+ state.extraComponents = prev === null || prev === void 0 ? void 0 : prev.extraComponents;
215
215
  state.boundingBox = prev === null || prev === void 0 ? void 0 : prev.boundingBox;
216
216
  state.backgroundColor = prev === null || prev === void 0 ? void 0 : prev.backgroundColor;
217
217
  }
218
218
  else if (state.pointer === 1) {
219
- state.components = current((_b = (_a = state.historyChanges) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.components);
220
- state.extraComponents = current((_d = (_c = state.historyChanges) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.extraComponents);
219
+ state.components = (_b = (_a = state.historyChanges) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.components;
220
+ state.extraComponents = (_d = (_c = state.historyChanges) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.extraComponents;
221
221
  state.boundingBox = (_f = (_e = state.historyChanges) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.boundingBox;
222
222
  state.backgroundColor = (_h = (_g = state.historyChanges) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.backgroundColor;
223
223
  state.pointer = 0;
@@ -340,7 +340,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
340
340
  const isInitialCreateElemente = toolElement.includes(activeTool) && !isCreateElementRef.current;
341
341
  const isInitialCreateBoundingBox = activeTool === "bounding-box";
342
342
  const isInitialCreateText = activeTool === "text" && !isCreateElementRef.current;
343
- console.log({ isInitialCreateText, }, isCreateElementRef.current);
343
+ // console.log({isInitialCreateText,},isCreateElementRef.current)
344
344
  if (isInitialCreateElemente) {
345
345
  const tables = createTableGhost({
346
346
  x,
@@ -432,7 +432,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
432
432
  hadSelectionRef.current = true;
433
433
  }
434
434
  if (downOutSelectionBox) {
435
- console.log("downOutSelectionBox");
435
+ // console.log("downOutSelectionBox");
436
436
  hadSelectionRef.current = false;
437
437
  onMoveSelectionBoxRef.current = false;
438
438
  handleUnSelectComponent();
@@ -854,6 +854,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
854
854
  const activeId = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id;
855
855
  const svg = svgRef.current;
856
856
  const { g, element, seats, seatGroup } = getAttributeElement(svg, activeId);
857
+ const isZeroRotate = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.rotation) === 0 && !(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape.includes("circle"));
857
858
  const elementSelect = {
858
859
  x: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.x,
859
860
  y: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.y,
@@ -878,6 +879,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
878
879
  dy,
879
880
  rotate: 0,
880
881
  handle: resizeSide,
882
+ isZeroRotate,
881
883
  });
882
884
  updateSelectionGuides(svg, resultSelection, {
883
885
  vLeft: "v-left",
@@ -890,8 +892,26 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
890
892
  updateSelectionBox(svg, resultSelection, activeId);
891
893
  const scaleX = resultSelection.width / oldSel.width;
892
894
  const scaleY = resultSelection.height / oldSel.height;
893
- const newWidth = elementSelect.width * scaleX;
894
- const newHeight = elementSelect.height * scaleY;
895
+ let newWidth = elementSelect.width * scaleX;
896
+ let newHeight = elementSelect.height * scaleY;
897
+ if (isZeroRotate) {
898
+ if (resizeSide === "right") {
899
+ newWidth = elementSelect.width + dx;
900
+ newHeight = elementSelect.height;
901
+ }
902
+ else if (resizeSide === "bottom") {
903
+ newWidth = elementSelect.width;
904
+ newHeight = elementSelect.height + dy;
905
+ }
906
+ else if (resizeSide === "left") {
907
+ newWidth = elementSelect.width - dx;
908
+ newHeight = elementSelect.height;
909
+ }
910
+ else if (resizeSide === "top") {
911
+ newWidth = elementSelect.width;
912
+ newHeight = elementSelect.height - dy;
913
+ }
914
+ }
895
915
  // Jarak relatif element dari pojok kiri atas selection (sebelum resize)
896
916
  const relativeX = elementSelect.x - oldSel.x;
897
917
  const relativeY = elementSelect.y - oldSel.y;
@@ -339,7 +339,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
339
339
  const isInitialCreateElemente = toolElement.includes(activeTool) && !isCreateElementRef.current;
340
340
  const isInitialCreateBoundingBox = activeTool === "bounding-box";
341
341
  const isInitialCreateText = activeTool === "text" && !isCreateElementRef.current;
342
- console.log({ isInitialCreateText, }, isCreateElementRef.current);
342
+ // console.log({isInitialCreateText,},isCreateElementRef.current)
343
343
  if (isInitialCreateElemente) {
344
344
  const tables = createTableGhost({
345
345
  x,
@@ -431,7 +431,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
431
431
  hadSelectionRef.current = true;
432
432
  }
433
433
  if (downOutSelectionBox) {
434
- console.log("downOutSelectionBox");
434
+ // console.log("downOutSelectionBox");
435
435
  hadSelectionRef.current = false;
436
436
  onMoveSelectionBoxRef.current = false;
437
437
  handleUnSelectComponent();
@@ -853,6 +853,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
853
853
  const activeId = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id;
854
854
  const svg = svgRef.current;
855
855
  const { g, element, seats, seatGroup } = getAttributeElement(svg, activeId);
856
+ const isZeroRotate = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.rotation) === 0 && !(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape.includes("circle"));
856
857
  const elementSelect = {
857
858
  x: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.x,
858
859
  y: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.y,
@@ -877,6 +878,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
877
878
  dy,
878
879
  rotate: 0,
879
880
  handle: resizeSide,
881
+ isZeroRotate,
880
882
  });
881
883
  updateSelectionGuides(svg, resultSelection, {
882
884
  vLeft: "v-left",
@@ -889,8 +891,26 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
889
891
  updateSelectionBox(svg, resultSelection, activeId);
890
892
  const scaleX = resultSelection.width / oldSel.width;
891
893
  const scaleY = resultSelection.height / oldSel.height;
892
- const newWidth = elementSelect.width * scaleX;
893
- const newHeight = elementSelect.height * scaleY;
894
+ let newWidth = elementSelect.width * scaleX;
895
+ let newHeight = elementSelect.height * scaleY;
896
+ if (isZeroRotate) {
897
+ if (resizeSide === "right") {
898
+ newWidth = elementSelect.width + dx;
899
+ newHeight = elementSelect.height;
900
+ }
901
+ else if (resizeSide === "bottom") {
902
+ newWidth = elementSelect.width;
903
+ newHeight = elementSelect.height + dy;
904
+ }
905
+ else if (resizeSide === "left") {
906
+ newWidth = elementSelect.width - dx;
907
+ newHeight = elementSelect.height;
908
+ }
909
+ else if (resizeSide === "top") {
910
+ newWidth = elementSelect.width;
911
+ newHeight = elementSelect.height - dy;
912
+ }
913
+ }
894
914
  // Jarak relatif element dari pojok kiri atas selection (sebelum resize)
895
915
  const relativeX = elementSelect.x - oldSel.x;
896
916
  const relativeY = elementSelect.y - oldSel.y;
@@ -9,7 +9,7 @@ export declare const resizeElementSelection: ({ selectionStart, currentSelection
9
9
  width: number;
10
10
  height: number;
11
11
  };
12
- export declare function resizeBox({ box, dx, dy, rotate, handle }: {
12
+ export declare function resizeBox({ box, dx, dy, rotate, handle, isZeroRotate, }: {
13
13
  box: {
14
14
  x: number;
15
15
  y: number;
@@ -20,6 +20,7 @@ export declare function resizeBox({ box, dx, dy, rotate, handle }: {
20
20
  dy: number;
21
21
  rotate: number;
22
22
  handle: ResizeHandle;
23
+ isZeroRotate?: boolean;
23
24
  }): {
24
25
  x: number;
25
26
  y: number;
@@ -43,7 +43,7 @@ export const resizeElementSelection = ({ selectionStart, currentSelection, rotat
43
43
  height,
44
44
  };
45
45
  };
46
- export function resizeBox({ box, dx, dy, rotate, handle }) {
46
+ export function resizeBox({ box, dx, dy, rotate, handle, isZeroRotate = false, }) {
47
47
  // 1. mouse → local
48
48
  const local = toLocalDelta(dx, dy, rotate);
49
49
  // 2. scale
@@ -52,11 +52,37 @@ export function resizeBox({ box, dx, dy, rotate, handle }) {
52
52
  // 3. anchor
53
53
  const { ax, ay } = getAnchor(handle, box);
54
54
  // 4. ukuran baru
55
- const newWidth = box.width * scale;
56
- const newHeight = box.height * scale;
55
+ let newWidth = box.width * scale;
56
+ let newHeight = box.height * scale;
57
57
  // 5. posisi baru dari anchor
58
- const newX = ax - newWidth * ((ax - box.x) / box.width);
59
- const newY = ay - newHeight * ((ay - box.y) / box.height);
58
+ let newX = ax - newWidth * ((ax - box.x) / box.width);
59
+ let newY = ay - newHeight * ((ay - box.y) / box.height);
60
+ if (isZeroRotate) {
61
+ if (handle === "right") {
62
+ newWidth = box.width + local.x;
63
+ newHeight = box.height;
64
+ newX = box.x;
65
+ newY = box.y;
66
+ }
67
+ else if (handle === "left") {
68
+ newWidth = box.width - local.x;
69
+ newX = box.x + local.x;
70
+ newHeight = box.height;
71
+ newY = box.y;
72
+ }
73
+ else if (handle === "bottom") {
74
+ newHeight = box.height + local.y;
75
+ newWidth = box.width;
76
+ newX = box.x;
77
+ newY = box.y;
78
+ }
79
+ else if (handle === "top") {
80
+ newHeight = box.height - local.y;
81
+ newY = box.y + local.y;
82
+ newWidth = box.width;
83
+ newX = box.x;
84
+ }
85
+ }
60
86
  return {
61
87
  x: newX,
62
88
  y: newY,
@@ -366,17 +392,17 @@ export const resizeSeatSide = ({ seatsPositions, r = 10, openSpace, newElement,
366
392
  start: newElement.y,
367
393
  length: newElement.height,
368
394
  count: rightCount,
369
- radius: r,
395
+ radius: seatRaidus,
370
396
  spacing: spacingHeight,
371
397
  });
372
398
  const rightSeats = rightYs.map((cy) => ({
373
- cx: newElement.x + newElement.width + +seatRaidus * 0.1,
399
+ cx: newElement.x + newElement.width + seatRaidus * 0.1,
374
400
  cy,
375
401
  id: "right",
376
402
  d: arcByDirection({
377
- cx: newElement.x + newElement.width + +seatRaidus * 0.1,
403
+ cx: newElement.x + newElement.width + seatRaidus * 0.1,
378
404
  cy,
379
- r,
405
+ r: seatRaidus,
380
406
  direction: "right",
381
407
  fraction: 0.4,
382
408
  }),
@@ -466,7 +492,7 @@ export const resizeSeatRectCircle = ({ seatsPositions, r = 10, openSpace, newEle
466
492
  spacing: spacingHeight,
467
493
  });
468
494
  const leftSeats = leftYs.map((cy) => ({
469
- x: -seatSizeLR.w,
495
+ x: x - seatSizeLR.w,
470
496
  y: cy - seatSizeLR.h / 2,
471
497
  width: seatSizeLR.w,
472
498
  height: seatSizeLR.h,
@@ -494,7 +520,7 @@ export const resizeSeatRectCircle = ({ seatsPositions, r = 10, openSpace, newEle
494
520
  spacing: spacingHeight,
495
521
  });
496
522
  const rightSeats = rightYs.map((cy) => ({
497
- x: width,
523
+ x: x + width,
498
524
  y: cy - seatSizeLR.h / 2,
499
525
  width: seatSizeLR.w,
500
526
  height: seatSizeLR.h,
@@ -583,22 +609,22 @@ export const resizeSeatRectSquare = ({ seatsPositions, r = 10, openSpace, newEle
583
609
  spacing: spacingWidth,
584
610
  });
585
611
  const topSeats = topXs.map((cx) => ({
586
- x: (cx) - seatSizeTB.w / 2,
612
+ x: cx - seatSizeTB.w / 2,
587
613
  y: y - seatSizeTB.h,
588
614
  width: seatSizeTB.w,
589
615
  height: seatSizeTB.h,
590
616
  id: "top",
591
617
  }));
592
618
  const leftYs = distributeWithSpacing({
593
- start: newElement.y,
619
+ start: 0,
594
620
  length: height,
595
621
  count: leftCount,
596
622
  radius: seatRadius,
597
623
  spacing: spacingHeight,
598
624
  });
599
625
  const leftSeats = leftYs.map((cy) => ({
600
- x: -seatSizeLR.w,
601
- y: cy - seatSizeLR.h / 2,
626
+ x: x - seatSizeLR.w,
627
+ y: y + cy - seatSizeLR.h / 2,
602
628
  width: seatSizeLR.w,
603
629
  height: seatSizeLR.h,
604
630
  id: "left",
@@ -618,15 +644,15 @@ export const resizeSeatRectSquare = ({ seatsPositions, r = 10, openSpace, newEle
618
644
  id: "bottom",
619
645
  }));
620
646
  const rightYs = distributeWithSpacing({
621
- start: newElement.y,
647
+ start: 0,
622
648
  length: newElement.height,
623
649
  count: rightCount,
624
650
  radius: seatRadius,
625
651
  spacing: spacingHeight,
626
652
  });
627
653
  const rightSeats = rightYs.map((cy) => ({
628
- x: width,
629
- y: cy - seatSizeLR.h / 2,
654
+ x: x + width,
655
+ y: y + cy - seatSizeLR.h / 2,
630
656
  width: seatSizeLR.w,
631
657
  height: seatSizeLR.h,
632
658
  id: "right",