seat-editor 2.0.0 → 2.1.1
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/package.json +1 -1
- package/dist/app/constant.d.ts +0 -101
- package/dist/app/constant.js +0 -3064
- package/dist/app/layout.d.ts +0 -6
- package/dist/app/layout.jsx +0 -27
- package/dist/app/new-board/page.d.ts +0 -1
- package/dist/app/new-board/page.jsx +0 -56
- package/dist/app/old-board/page.d.ts +0 -3
- package/dist/app/old-board/page.jsx +0 -510
- package/dist/app/only-view/constant.d.ts +0 -40
- package/dist/app/only-view/constant.js +0 -1336
- package/dist/app/only-view/page.d.ts +0 -2
- package/dist/app/only-view/page.jsx +0 -40
- package/dist/app/page.d.ts +0 -2
- package/dist/app/page.jsx +0 -13
- package/dist/app/test/page.d.ts +0 -2
- package/dist/app/test/page.jsx +0 -45
- package/dist/app/v2/page.d.ts +0 -2
- package/dist/app/v2/page.jsx +0 -13
- package/dist/components/button-tools/index.d.ts +0 -11
- package/dist/components/button-tools/index.jsx +0 -17
- package/dist/components/form-tools/label.d.ts +0 -2
- package/dist/components/form-tools/label.jsx +0 -44
- package/dist/components/form-tools/shape.d.ts +0 -4
- package/dist/components/form-tools/shape.jsx +0 -66
- package/dist/components/input/number-indicator.d.ts +0 -7
- package/dist/components/input/number-indicator.jsx +0 -36
- package/dist/components/joystick/index.d.ts +0 -12
- package/dist/components/joystick/index.jsx +0 -49
- package/dist/components/layer/index.d.ts +0 -19
- package/dist/components/layer/index.jsx +0 -383
- package/dist/components/layer-v2/index.d.ts +0 -19
- package/dist/components/layer-v2/index.jsx +0 -370
- package/dist/components/layer-v3/index.d.ts +0 -19
- package/dist/components/layer-v3/index.jsx +0 -418
- package/dist/components/lib/index.d.ts +0 -8
- package/dist/components/lib/index.jsx +0 -33
- package/dist/components/modal-preview/index.d.ts +0 -4
- package/dist/components/modal-preview/index.jsx +0 -11
- package/dist/features/board/board-slice.d.ts +0 -14
- package/dist/features/board/board-slice.js +0 -52
- package/dist/features/board/index.d.ts +0 -6
- package/dist/features/board/index.jsx +0 -725
- package/dist/features/board-v2/board-slice.d.ts +0 -14
- package/dist/features/board-v2/board-slice.js +0 -52
- package/dist/features/board-v2/index.d.ts +0 -8
- package/dist/features/board-v2/index.jsx +0 -869
- package/dist/features/board-v3/board-slice.d.ts +0 -16
- package/dist/features/board-v3/board-slice.js +0 -83
- package/dist/features/board-v3/history-slice.d.ts +0 -27
- package/dist/features/board-v3/history-slice.js +0 -27
- package/dist/features/board-v3/index.d.ts +0 -8
- package/dist/features/board-v3/index.jsx +0 -863
- package/dist/features/navbar/index.d.ts +0 -2
- package/dist/features/navbar/index.jsx +0 -5
- package/dist/features/package/index.d.ts +0 -31
- package/dist/features/package/index.jsx +0 -114
- package/dist/features/panel/index.d.ts +0 -11
- package/dist/features/panel/index.jsx +0 -138
- package/dist/features/panel/panel-slice.d.ts +0 -16
- package/dist/features/panel/panel-slice.js +0 -31
- package/dist/features/panel/select-tool.d.ts +0 -6
- package/dist/features/panel/select-tool.jsx +0 -60
- package/dist/features/panel/square-circle-tool.d.ts +0 -2
- package/dist/features/panel/square-circle-tool.jsx +0 -10
- package/dist/features/panel/table-seat-circle.d.ts +0 -2
- package/dist/features/panel/table-seat-circle.jsx +0 -31
- package/dist/features/panel/text-tool.d.ts +0 -2
- package/dist/features/panel/text-tool.jsx +0 -26
- package/dist/features/panel/upload-tool.d.ts +0 -14
- package/dist/features/panel/upload-tool.jsx +0 -152
- package/dist/features/side-tool/index.d.ts +0 -8
- package/dist/features/side-tool/index.jsx +0 -371
- package/dist/features/side-tool/side-tool-slice.d.ts +0 -16
- package/dist/features/side-tool/side-tool-slice.js +0 -28
- package/dist/features/theme/theme-slice.d.ts +0 -12
- package/dist/features/theme/theme-slice.js +0 -15
- package/dist/features/view/index.d.ts +0 -19
- package/dist/features/view/index.jsx +0 -228
- package/dist/features/view-only/index.d.ts +0 -19
- package/dist/features/view-only/index.jsx +0 -206
- package/dist/features/view-only-2/index.d.ts +0 -19
- package/dist/features/view-only-2/index.jsx +0 -181
- package/dist/hooks/use-redux.d.ts +0 -4
- package/dist/hooks/use-redux.js +0 -3
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/libs/middleware.d.ts +0 -2
- package/dist/libs/middleware.js +0 -5
- package/dist/libs/rootReducer.d.ts +0 -12
- package/dist/libs/rootReducer.js +0 -14
- package/dist/libs/store.d.ts +0 -18
- package/dist/libs/store.js +0 -19
- package/dist/provider/antd-provider.d.ts +0 -4
- package/dist/provider/antd-provider.jsx +0 -46
- package/dist/provider/redux-provider.d.ts +0 -3
- package/dist/provider/redux-provider.jsx +0 -6
- package/dist/provider/store-provider.d.ts +0 -4
- package/dist/provider/store-provider.jsx +0 -10
- package/dist/utils/injectCss.d.ts +0 -1
- package/dist/utils/injectCss.js +0 -13
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import LayerView from "@/features/view";
|
|
3
|
-
import { useState, useEffect } from "react";
|
|
4
|
-
import { dataDummy } from "./constant";
|
|
5
|
-
const TouchScrollDetect = () => {
|
|
6
|
-
const [fingerCount, setFingerCount] = useState(0);
|
|
7
|
-
const [scrollType, setScrollType] = useState(""); // untuk kondisi tampilan
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
const container = document.getElementById("scroll-container");
|
|
10
|
-
const handleTouchStart = (e) => {
|
|
11
|
-
const count = e.touches.length;
|
|
12
|
-
setFingerCount(count);
|
|
13
|
-
if (count === 1) {
|
|
14
|
-
setScrollType("one");
|
|
15
|
-
}
|
|
16
|
-
else if (count === 2) {
|
|
17
|
-
setScrollType("two");
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
setScrollType("other");
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const handleTouchEnd = () => {
|
|
24
|
-
setFingerCount(0);
|
|
25
|
-
setScrollType(""); // reset saat tidak ada sentuhan
|
|
26
|
-
};
|
|
27
|
-
if (container) {
|
|
28
|
-
container.addEventListener("touchstart", handleTouchStart);
|
|
29
|
-
container.addEventListener("touchend", handleTouchEnd);
|
|
30
|
-
}
|
|
31
|
-
return () => {
|
|
32
|
-
if (container) {
|
|
33
|
-
container.removeEventListener("touchstart", handleTouchStart);
|
|
34
|
-
container.removeEventListener("touchend", handleTouchEnd);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}, []);
|
|
38
|
-
return (<LayerView statusKey="status" defaultBackground="#000000" componentProps={dataDummy} extraComponentProps={[]}/>);
|
|
39
|
-
};
|
|
40
|
-
export default TouchScrollDetect;
|
package/dist/app/page.d.ts
DELETED
package/dist/app/page.jsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import Board from "../features/board-v3";
|
|
2
|
-
import SideTool from "../features/side-tool";
|
|
3
|
-
import ControlPanels from "../features/panel";
|
|
4
|
-
const TableEditor = () => {
|
|
5
|
-
return (<>
|
|
6
|
-
<div className="w-full h-screen flex relative">
|
|
7
|
-
<SideTool />
|
|
8
|
-
<Board />
|
|
9
|
-
<ControlPanels />
|
|
10
|
-
</div>
|
|
11
|
-
</>);
|
|
12
|
-
};
|
|
13
|
-
export default TableEditor;
|
package/dist/app/test/page.d.ts
DELETED
package/dist/app/test/page.jsx
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { useRef, useState } from "react";
|
|
3
|
-
export default function DraggableRect() {
|
|
4
|
-
const rectRef = useRef(null);
|
|
5
|
-
const [pos, setPos] = useState({ x: 100, y: 100 });
|
|
6
|
-
const [dragging, setDragging] = useState(false);
|
|
7
|
-
const [offset, setOffset] = useState({ x: 0, y: 0 });
|
|
8
|
-
const getCoords = (e) => {
|
|
9
|
-
if ("touches" in e) {
|
|
10
|
-
return {
|
|
11
|
-
x: e.touches[0].clientX,
|
|
12
|
-
y: e.touches[0].clientY,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
x: e.clientX,
|
|
17
|
-
y: e.clientY,
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
const handleStart = (e) => {
|
|
21
|
-
e.preventDefault();
|
|
22
|
-
const coords = getCoords(e);
|
|
23
|
-
setOffset({
|
|
24
|
-
x: coords.x - pos.x,
|
|
25
|
-
y: coords.y - pos.y,
|
|
26
|
-
});
|
|
27
|
-
setDragging(true);
|
|
28
|
-
};
|
|
29
|
-
const handleMove = (e) => {
|
|
30
|
-
if (!dragging)
|
|
31
|
-
return;
|
|
32
|
-
const coords = getCoords(e);
|
|
33
|
-
setPos({
|
|
34
|
-
x: coords.x - offset.x,
|
|
35
|
-
y: coords.y - offset.y,
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
const handleEnd = () => {
|
|
39
|
-
setDragging(false);
|
|
40
|
-
};
|
|
41
|
-
return (<svg width="100%" height="500" viewBox="0 0 800 600" style={{ border: "1px solid black", touchAction: "none" }} // important!
|
|
42
|
-
onMouseMove={handleMove} onMouseUp={handleEnd} onTouchMove={handleMove} onTouchEnd={handleEnd}>
|
|
43
|
-
<rect ref={rectRef} x={pos.x} y={pos.y} width="150" height="100" fill="tomato" onMouseDown={handleStart} onTouchStart={handleStart} style={{ cursor: "grab" }}/>
|
|
44
|
-
</svg>);
|
|
45
|
-
}
|
package/dist/app/v2/page.d.ts
DELETED
package/dist/app/v2/page.jsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import Board from "../../features/board-v2";
|
|
2
|
-
import SideTool from "../../features/side-tool";
|
|
3
|
-
import ControlPanels from "../../features/panel";
|
|
4
|
-
const TableEditor = () => {
|
|
5
|
-
return (<>
|
|
6
|
-
<div className="w-full h-screen flex relative">
|
|
7
|
-
<SideTool />
|
|
8
|
-
<Board />
|
|
9
|
-
<ControlPanels />
|
|
10
|
-
</div>
|
|
11
|
-
</>);
|
|
12
|
-
};
|
|
13
|
-
export default TableEditor;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ButtonProps, PopoverProps } from "antd";
|
|
2
|
-
interface ButtonToolsProps {
|
|
3
|
-
buttonProps: ButtonProps;
|
|
4
|
-
items: Array<{
|
|
5
|
-
label: string;
|
|
6
|
-
onClick: () => void;
|
|
7
|
-
}>;
|
|
8
|
-
popoverProps?: PopoverProps;
|
|
9
|
-
}
|
|
10
|
-
declare const ButtonTools: (props: ButtonToolsProps) => import("react").JSX.Element;
|
|
11
|
-
export default ButtonTools;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Button, Popover } from "antd";
|
|
3
|
-
const ButtonTools = (props) => {
|
|
4
|
-
const { buttonProps, items, popoverProps } = props;
|
|
5
|
-
if (items.length === 0) {
|
|
6
|
-
return (<Popover trigger="hover" {...popoverProps}>
|
|
7
|
-
<Button {...buttonProps}/>
|
|
8
|
-
</Popover>);
|
|
9
|
-
}
|
|
10
|
-
return (<Popover content={<div>
|
|
11
|
-
<Button>Button 1</Button>
|
|
12
|
-
<Button>Button 2</Button>
|
|
13
|
-
</div>} trigger="click">
|
|
14
|
-
<Button {...buttonProps}/>
|
|
15
|
-
</Popover>);
|
|
16
|
-
};
|
|
17
|
-
export default ButtonTools;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Button, ColorPicker, Flex, Form, Input, InputNumber } from "antd";
|
|
3
|
-
const SectionLabel = () => {
|
|
4
|
-
return (<div className="py-2">
|
|
5
|
-
<h1 className="heading-s">Section Labeling</h1>
|
|
6
|
-
<Form.Item label="Labels in square" name={"labels"}>
|
|
7
|
-
<Form.List name="labels">
|
|
8
|
-
{(fields, { add, remove }) => (<>
|
|
9
|
-
{fields.map((field) => (<div key={field.key}>
|
|
10
|
-
<Flex gap={2}>
|
|
11
|
-
<Form.Item name={[field.name, "label"]} label="Text">
|
|
12
|
-
<Input />
|
|
13
|
-
</Form.Item>
|
|
14
|
-
<Form.Item name={[field.name, "fontColor"]} label="Color" getValueFromEvent={(color) => color.toHexString()}>
|
|
15
|
-
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
16
|
-
</Form.Item>
|
|
17
|
-
</Flex>
|
|
18
|
-
<Flex gap={2}>
|
|
19
|
-
<Form.Item name={[field.name, "x"]} label="X">
|
|
20
|
-
<InputNumber />
|
|
21
|
-
</Form.Item>
|
|
22
|
-
<Form.Item name={[field.name, "y"]} label="Y">
|
|
23
|
-
<InputNumber />
|
|
24
|
-
</Form.Item>
|
|
25
|
-
<Form.Item name={[field.name, "fontSize"]} label="Size">
|
|
26
|
-
<InputNumber suffix="px"/>
|
|
27
|
-
</Form.Item>
|
|
28
|
-
</Flex>
|
|
29
|
-
</div>))}
|
|
30
|
-
<Flex gap={2}>
|
|
31
|
-
<Button type="primary" onClick={() => add()} className="btn btn-primary">
|
|
32
|
-
Add
|
|
33
|
-
</Button>
|
|
34
|
-
<Button type="primary" onClick={() => remove(fields.length - 1)} className="btn btn-primary">
|
|
35
|
-
Remove
|
|
36
|
-
</Button>
|
|
37
|
-
</Flex>
|
|
38
|
-
</>)}
|
|
39
|
-
</Form.List>
|
|
40
|
-
</Form.Item>
|
|
41
|
-
<div className="divider-dashed"/>
|
|
42
|
-
</div>);
|
|
43
|
-
};
|
|
44
|
-
export default SectionLabel;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { ColorPicker, Flex, Form, InputNumber, Select } from "antd";
|
|
3
|
-
const SectionShape = ({ allowChangeShape = true, }) => {
|
|
4
|
-
const optionsShape = [
|
|
5
|
-
{
|
|
6
|
-
value: "circle",
|
|
7
|
-
label: "Circle",
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
value: "square",
|
|
11
|
-
label: "Square",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
value: "table-seat-circle",
|
|
15
|
-
label: "Table Seat Circle",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
label: "Image Table",
|
|
19
|
-
value: "image-table",
|
|
20
|
-
},
|
|
21
|
-
];
|
|
22
|
-
return (<div className="py-2">
|
|
23
|
-
<h1 className="heading-s">Shape</h1>
|
|
24
|
-
{allowChangeShape && (<Flex gap={2} className="w-full">
|
|
25
|
-
<Form.Item label="Name" name="shape" className="w-full">
|
|
26
|
-
<Select options={optionsShape} className="w-full"/>
|
|
27
|
-
</Form.Item>
|
|
28
|
-
</Flex>)}
|
|
29
|
-
<Flex gap={2} className="w-full">
|
|
30
|
-
<Form.Item label="Width" name="width" className="w-full">
|
|
31
|
-
<InputNumber suffix="px"/>
|
|
32
|
-
</Form.Item>
|
|
33
|
-
<Form.Item label="Height" name="height" className="w-full">
|
|
34
|
-
<InputNumber suffix="px"/>
|
|
35
|
-
</Form.Item>
|
|
36
|
-
</Flex>
|
|
37
|
-
<Flex gap={2}>
|
|
38
|
-
<Form.Item label="Position X" name="x" className="w-full">
|
|
39
|
-
<InputNumber />
|
|
40
|
-
</Form.Item>
|
|
41
|
-
<Form.Item label="Position Y" name="y" className="w-full">
|
|
42
|
-
<InputNumber />
|
|
43
|
-
</Form.Item>
|
|
44
|
-
<Form.Item label="Rotation" name="rotation" className="w-full">
|
|
45
|
-
<InputNumber />
|
|
46
|
-
</Form.Item>
|
|
47
|
-
</Flex>
|
|
48
|
-
<Flex gap={2}>
|
|
49
|
-
<Form.Item label="Fill" name={"fill"} getValueFromEvent={(color) => color.toHexString()} className="w-full ">
|
|
50
|
-
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
51
|
-
</Form.Item>
|
|
52
|
-
<Form.Item label="Stroke" name={"stroke"} getValueFromEvent={(color) => color.toHexString()} className="w-full ">
|
|
53
|
-
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
54
|
-
</Form.Item>
|
|
55
|
-
</Flex>
|
|
56
|
-
<Flex>
|
|
57
|
-
<Form.Item label="Stroke Width" name={"strokeWidth"} className="w-full">
|
|
58
|
-
<InputNumber />
|
|
59
|
-
</Form.Item>
|
|
60
|
-
<Form.Item label="opacity" name={"opacity"} className="w-full">
|
|
61
|
-
<InputNumber step={0.1} max={1} min={0}/>
|
|
62
|
-
</Form.Item>
|
|
63
|
-
</Flex>
|
|
64
|
-
</div>);
|
|
65
|
-
};
|
|
66
|
-
export default SectionShape;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
interface NumberIndicatorProps {
|
|
2
|
-
name: string;
|
|
3
|
-
defaultValue?: number;
|
|
4
|
-
onChange: (value: number) => void;
|
|
5
|
-
}
|
|
6
|
-
declare const NumberIndicator: ({ name, defaultValue, onChange }: NumberIndicatorProps) => import("react").JSX.Element;
|
|
7
|
-
export default NumberIndicator;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
import { Input, Button, Flex, Form } from "antd";
|
|
4
|
-
import { ArrowRight, ArrowLeft } from "lucide-react";
|
|
5
|
-
const NumberIndicator = ({ name, defaultValue, onChange }) => {
|
|
6
|
-
const [value, setValue] = useState(0);
|
|
7
|
-
const form = Form.useFormInstance();
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
if (defaultValue) {
|
|
10
|
-
setValue(defaultValue);
|
|
11
|
-
form.setFieldsValue({ [name]: defaultValue });
|
|
12
|
-
}
|
|
13
|
-
}, [defaultValue]);
|
|
14
|
-
const handlePrev = () => {
|
|
15
|
-
setValue(value - 1);
|
|
16
|
-
form.setFieldsValue({ [name]: value - 1 });
|
|
17
|
-
onChange(value - 1);
|
|
18
|
-
};
|
|
19
|
-
const handleNext = () => {
|
|
20
|
-
setValue(value + 1);
|
|
21
|
-
form.setFieldsValue({ [name]: value + 1 });
|
|
22
|
-
onChange(value + 1);
|
|
23
|
-
};
|
|
24
|
-
return (<Flex gap={2}>
|
|
25
|
-
<Button onClick={handlePrev}>
|
|
26
|
-
<ArrowLeft />
|
|
27
|
-
</Button>
|
|
28
|
-
<Form.Item name={name} noStyle>
|
|
29
|
-
<Input className="flex text-center" type="number" value={value} name={name} onChange={(e) => setValue(parseInt(e.target.value))}/>
|
|
30
|
-
</Form.Item>
|
|
31
|
-
<Button onClick={handleNext}>
|
|
32
|
-
<ArrowRight />
|
|
33
|
-
</Button>
|
|
34
|
-
</Flex>);
|
|
35
|
-
};
|
|
36
|
-
export default NumberIndicator;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type JoystickPosition = {
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
};
|
|
6
|
-
type JoystickProps = {
|
|
7
|
-
size?: number;
|
|
8
|
-
onMove?: (pos: JoystickPosition) => void;
|
|
9
|
-
onEnd?: () => void;
|
|
10
|
-
};
|
|
11
|
-
export declare const Joystick: ({ size, onMove, onEnd, }: JoystickProps) => React.JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Joystick.tsx
|
|
2
|
-
import React, { useRef, useState } from "react";
|
|
3
|
-
export const Joystick = ({ size = 120, onMove, onEnd, }) => {
|
|
4
|
-
const baseRef = useRef(null);
|
|
5
|
-
const [position, setPosition] = useState({ x: 0, y: 0 });
|
|
6
|
-
const handleMove = (e) => {
|
|
7
|
-
const base = baseRef.current;
|
|
8
|
-
if (!base)
|
|
9
|
-
return;
|
|
10
|
-
const rect = base.getBoundingClientRect();
|
|
11
|
-
const isTouch = "touches" in e;
|
|
12
|
-
const clientX = isTouch ? e.touches[0].clientX : e.clientX;
|
|
13
|
-
const clientY = isTouch ? e.touches[0].clientY : e.clientY;
|
|
14
|
-
const centerX = rect.left + rect.width / 2;
|
|
15
|
-
const centerY = rect.top + rect.height / 2;
|
|
16
|
-
const dx = clientX - centerX;
|
|
17
|
-
const dy = clientY - centerY;
|
|
18
|
-
const distance = Math.min(Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)), size / 2 - 20);
|
|
19
|
-
const angle = Math.atan2(dy, dx);
|
|
20
|
-
const x = Math.cos(angle) * distance;
|
|
21
|
-
const y = Math.sin(angle) * distance;
|
|
22
|
-
setPosition({ x, y });
|
|
23
|
-
onMove === null || onMove === void 0 ? void 0 : onMove({ x, y });
|
|
24
|
-
};
|
|
25
|
-
const handleEnd = () => {
|
|
26
|
-
setPosition({ x: 0, y: 0 });
|
|
27
|
-
onEnd === null || onEnd === void 0 ? void 0 : onEnd();
|
|
28
|
-
};
|
|
29
|
-
return (<div ref={baseRef} onMouseMove={(e) => e.buttons === 1 && handleMove(e)} onMouseUp={handleEnd} onMouseLeave={handleEnd} onTouchMove={handleMove} onTouchEnd={handleEnd} style={{
|
|
30
|
-
width: size,
|
|
31
|
-
height: size,
|
|
32
|
-
background: "#ddd",
|
|
33
|
-
borderRadius: "50%",
|
|
34
|
-
position: "relative",
|
|
35
|
-
touchAction: "none",
|
|
36
|
-
userSelect: "none",
|
|
37
|
-
}}>
|
|
38
|
-
<div onMouseDown={handleMove} onTouchStart={handleMove} style={{
|
|
39
|
-
width: 40,
|
|
40
|
-
height: 40,
|
|
41
|
-
background: "#3E97FF",
|
|
42
|
-
borderRadius: "50%",
|
|
43
|
-
position: "absolute",
|
|
44
|
-
left: `calc(50% + ${position.x}px - 20px)`,
|
|
45
|
-
top: `calc(50% + ${position.y}px - 20px)`,
|
|
46
|
-
touchAction: "none",
|
|
47
|
-
}}/>
|
|
48
|
-
</div>);
|
|
49
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
interface LayersProps {
|
|
2
|
-
shadowShape?: any[];
|
|
3
|
-
components?: any[];
|
|
4
|
-
onClick?: (items: any) => void;
|
|
5
|
-
selectedComponent?: any;
|
|
6
|
-
activeTool?: string;
|
|
7
|
-
onMouseDown?: (e: React.MouseEvent, item: any, direction?: string) => void;
|
|
8
|
-
onMouseUp?: (e: React.MouseEvent) => void;
|
|
9
|
-
onBlur?: () => void;
|
|
10
|
-
selectedTable?: any;
|
|
11
|
-
selectedTableColor?: string;
|
|
12
|
-
style?: any;
|
|
13
|
-
mode?: "view" | "edit";
|
|
14
|
-
onTouchStart?: (e: React.TouchEvent<SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement>, items: any, direction?: string) => void;
|
|
15
|
-
onTouchMove?: (e: React.TouchEvent<SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement>) => void;
|
|
16
|
-
onTouchEnd?: (e: React.TouchEvent<SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement>) => void;
|
|
17
|
-
}
|
|
18
|
-
declare const Layers: ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode, style, onTouchEnd, onTouchMove, onTouchStart }: LayersProps) => import("react").JSX.Element;
|
|
19
|
-
export default Layers;
|