seat-editor 3.0.0 → 3.0.2
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/layout.d.ts +1 -1
- package/dist/app/{layout.js → layout.jsx} +7 -2
- package/dist/app/new-board/page.d.ts +1 -1
- package/dist/app/new-board/page.jsx +55 -0
- package/dist/app/old-board/page.d.ts +2 -1
- package/dist/app/old-board/{page.js → page.jsx} +215 -82
- package/dist/app/only-view/chair.d.ts +1 -1
- package/dist/app/only-view/chair.js +10 -2
- package/dist/app/only-view/page.d.ts +1 -1
- package/dist/app/only-view/page.jsx +101 -0
- package/dist/app/only-view/user.d.ts +1 -1
- package/dist/app/only-view/user.js +10 -2
- package/dist/app/page.d.ts +1 -1
- package/dist/app/page.jsx +13 -0
- package/dist/app/test/page.d.ts +2 -1
- package/dist/app/test/{page.js → page.jsx} +5 -3
- package/dist/app/v2/page.d.ts +1 -1
- package/dist/app/v2/page.jsx +13 -0
- package/dist/components/button-tools/index.d.ts +1 -1
- package/dist/components/button-tools/index.jsx +17 -0
- package/dist/components/form-tools/label.d.ts +1 -1
- package/dist/components/form-tools/label.jsx +44 -0
- package/dist/components/form-tools/shape.d.ts +1 -1
- package/dist/components/form-tools/shape.jsx +66 -0
- package/dist/components/input/number-indicator.d.ts +1 -1
- package/dist/components/input/{number-indicator.js → number-indicator.jsx} +11 -2
- package/dist/components/joystick/index.d.ts +2 -1
- package/dist/components/joystick/{index.js → index.jsx} +14 -13
- package/dist/components/layer/index.d.ts +1 -1
- package/dist/components/layer/index.jsx +383 -0
- package/dist/components/layer-v2/index.d.ts +1 -1
- package/dist/components/layer-v2/index.jsx +370 -0
- package/dist/components/layer-v3/index.d.ts +1 -1
- package/dist/components/layer-v3/{index.js → index.jsx} +242 -102
- package/dist/components/layer-v4/index.d.ts +1 -1
- package/dist/components/layer-v4/{index.js → index.jsx} +157 -80
- package/dist/components/lib/index.d.ts +1 -1
- package/dist/components/lib/{index.js → index.jsx} +7 -2
- package/dist/components/modal-preview/index.d.ts +1 -1
- package/dist/components/modal-preview/index.jsx +11 -0
- package/dist/features/board/index.d.ts +1 -1
- package/dist/features/board/{index.js → index.jsx} +90 -31
- package/dist/features/board-v2/index.d.ts +2 -1
- package/dist/features/board-v2/{index.js → index.jsx} +101 -39
- package/dist/features/board-v3/index copy.d.ts +2 -1
- package/dist/features/board-v3/{index copy.js → index copy.jsx } +128 -50
- package/dist/features/board-v3/index.d.ts +2 -1
- package/dist/features/board-v3/{index.js → index.jsx} +110 -32
- package/dist/features/navbar/index.d.ts +1 -1
- package/dist/features/navbar/index.jsx +5 -0
- package/dist/features/package/index.d.ts +1 -1
- package/dist/features/package/{index.js → index.jsx} +16 -6
- package/dist/features/panel/index.d.ts +1 -1
- package/dist/features/panel/{index.js → index.jsx} +25 -7
- package/dist/features/panel/select-tool.d.ts +1 -1
- package/dist/features/panel/{select-tool.js → select-tool.jsx} +23 -10
- package/dist/features/panel/selected-group.d.ts +1 -1
- package/dist/features/panel/selected-group.jsx +47 -0
- package/dist/features/panel/square-circle-tool.d.ts +1 -1
- package/dist/features/panel/{square-circle-tool.js → square-circle-tool.jsx} +4 -2
- package/dist/features/panel/table-seat-circle.d.ts +1 -1
- package/dist/features/panel/table-seat-circle.jsx +31 -0
- package/dist/features/panel/table-seat-square.d.ts +1 -1
- package/dist/features/panel/table-seat-square.jsx +46 -0
- package/dist/features/panel/text-tool.d.ts +1 -1
- package/dist/features/panel/text-tool.jsx +26 -0
- package/dist/features/panel/upload-tool.d.ts +1 -1
- package/dist/features/panel/{upload-tool.js → upload-tool.jsx} +24 -2
- package/dist/features/side-tool/index.d.ts +1 -1
- package/dist/features/side-tool/{index.js → index.jsx} +120 -98
- package/dist/features/view-only/index.d.ts +1 -1
- package/dist/features/view-only/{index.js → index.jsx} +38 -31
- package/dist/features/view-only-2/index.d.ts +1 -1
- package/dist/features/view-only-2/{index.js → index.jsx} +16 -13
- package/dist/features/view-only-3/index.d.ts +1 -1
- package/dist/features/view-only-3/{index.js → index.jsx} +46 -27
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/provider/antd-provider.jsx +46 -0
- package/dist/provider/redux-provider.d.ts +1 -1
- package/dist/provider/{redux-provider.js → redux-provider.jsx} +1 -2
- package/dist/provider/store-provider.d.ts +1 -1
- package/dist/provider/{store-provider.js → store-provider.jsx} +3 -2
- package/package.json +1 -1
- package/dist/app/new-board/page.js +0 -33
- package/dist/app/only-view/page.js +0 -78
- package/dist/app/page.js +0 -8
- package/dist/app/v2/page.js +0 -8
- package/dist/components/button-tools/index.js +0 -11
- package/dist/components/form-tools/label.js +0 -7
- package/dist/components/form-tools/shape.js +0 -25
- package/dist/components/layer/index.js +0 -295
- package/dist/components/layer-v2/index.js +0 -282
- package/dist/components/modal-preview/index.js +0 -10
- package/dist/features/navbar/index.js +0 -6
- package/dist/features/panel/selected-group.js +0 -7
- package/dist/features/panel/table-seat-circle.js +0 -9
- package/dist/features/panel/table-seat-square.js +0 -9
- package/dist/features/panel/text-tool.js +0 -7
- package/dist/provider/antd-provider.js +0 -43
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
interface BoardTemplateProps {
|
|
2
3
|
onSelectComponent?: (items: any) => void;
|
|
3
4
|
mappingKey?: string;
|
|
4
5
|
viewOnly?: boolean;
|
|
5
6
|
}
|
|
6
|
-
declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) =>
|
|
7
|
+
declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) => React.JSX.Element;
|
|
7
8
|
export default BoardTemplate;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
4
3
|
import { TransformWrapper, TransformComponent, MiniMap, } from "react-zoom-pan-pinch";
|
|
5
4
|
import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
|
|
6
5
|
import Layers from "../../components/layer-v2";
|
|
@@ -696,15 +695,21 @@ const BoardTemplate = ({ onSelectComponent, viewOnly }) => {
|
|
|
696
695
|
}
|
|
697
696
|
};
|
|
698
697
|
const renderMiniMap = () => {
|
|
699
|
-
return (
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
698
|
+
return (<MiniMap width={250} height={250}>
|
|
699
|
+
<div className="w-full h-full">
|
|
700
|
+
<svg id="workspace" width="100%" height="100%" viewBox={`0 0 ${widthBoard} ${heightBoard}`} className="h-screen w-full" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style={{
|
|
701
|
+
background: "#f5f5f5",
|
|
702
|
+
display: "block",
|
|
703
|
+
}}>
|
|
704
|
+
<Layers shadowShape={shadowShape} components={[...extraComponentsState, ...componentsState]} activeTool={activeTool}
|
|
705
|
+
// onClick={handleSelectComponent}
|
|
706
|
+
// onMouseDown={handleMouseDown}
|
|
707
|
+
// onMouseUp={handleMouseUp}
|
|
708
|
+
// onBlur={handleUnSelectComponent}
|
|
709
|
+
selectedComponent={selectedComponent}/>
|
|
710
|
+
</svg>
|
|
711
|
+
</div>
|
|
712
|
+
</MiniMap>);
|
|
708
713
|
};
|
|
709
714
|
const handelZoomIn = () => {
|
|
710
715
|
var _a;
|
|
@@ -775,33 +780,90 @@ const BoardTemplate = ({ onSelectComponent, viewOnly }) => {
|
|
|
775
780
|
setNodes(newNodes);
|
|
776
781
|
}
|
|
777
782
|
};
|
|
778
|
-
return (
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
783
|
+
return (<>
|
|
784
|
+
<ModalPreview>
|
|
785
|
+
<LayerView statusKey="status"/>
|
|
786
|
+
</ModalPreview>
|
|
787
|
+
<div className="relative w-full h-screen flex-1 overflow-hidden" ref={containerRef}>
|
|
788
|
+
<div className="absolute bottom-5 left-1/2 transform -translate-x-1/2 z-10">
|
|
789
|
+
<div className="flex gap-2">
|
|
790
|
+
<Button icon={<ZoomIn />} onClick={handelZoomIn}/>
|
|
791
|
+
<Button icon={<ZoomOut />} onClick={handleZoomOut}/>
|
|
792
|
+
<Button onClick={addNode}>Add Node</Button>
|
|
793
|
+
<Button onClick={removeNode}>Remove Node</Button>
|
|
794
|
+
</div>
|
|
795
|
+
</div>
|
|
796
|
+
<TransformWrapper ref={transformRef} panning={{ disabled: ["node", "select"].includes(activeTool) }} centerZoomedOut={true} onTransformed={({ state: { scale } }) => setScale(scale)} minScale={1} // sangat kecil = bisa zoom out jauh
|
|
797
|
+
maxScale={1000} initialScale={1} pinch={{ step: 1 }} smooth={true} doubleClick={{ step: 1, disabled: activeTool === "select" }} disablePadding>
|
|
798
|
+
{scale > 1 && (<div className="absolute bottom-[60px] left-1/2 transform -translate-x-1/2 z-10">
|
|
799
|
+
{renderMiniMap()}
|
|
800
|
+
</div>)}
|
|
801
|
+
<TransformComponent wrapperStyle={{
|
|
802
|
+
width: "100%",
|
|
803
|
+
height: "100%",
|
|
804
|
+
overflow: "hidden",
|
|
805
|
+
}} contentStyle={{
|
|
806
|
+
width: "100%",
|
|
807
|
+
height: "100%",
|
|
808
|
+
}}>
|
|
809
|
+
<svg id="workspace" ref={svgRef} width="100%" height="100%" viewBox={`0 0 ${widthBoard} ${heightBoard}`} className="h-screen" onMouseUp={handleMouseUp} onMouseMove={handleMouseMove}
|
|
810
|
+
// onMouseEnter={handleMouseEnter}
|
|
811
|
+
// onMouseUp={handleEnd}
|
|
812
|
+
onTouchMove={handleMouseMove} onTouchEnd={handleMouseUp} onClick={(e) => {
|
|
813
|
+
e.stopPropagation();
|
|
814
|
+
handleMouseClick(e);
|
|
815
|
+
}}
|
|
816
|
+
// onMouseLeave={handleMouseLeave}
|
|
817
|
+
xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style={{
|
|
818
|
+
background: backgroundColor,
|
|
819
|
+
display: "block",
|
|
820
|
+
cursor: activeTool === "ruler" ? "crosshair" : "auto",
|
|
821
|
+
touchAction: "none",
|
|
822
|
+
}}>
|
|
823
|
+
<Layers shadowShape={shadowShape} components={[...extraComponentsState, ...componentsState]} style={{
|
|
824
|
+
cursor: getCursorStyle(),
|
|
825
|
+
}}
|
|
826
|
+
// onClick={handleSelectComponent}
|
|
827
|
+
onMouseDown={handleMouseDown}
|
|
828
|
+
// onMouseUp={handleMouseUp}
|
|
829
|
+
// onBlur={handleUnSelectComponent}
|
|
830
|
+
selectedComponent={selectedComponent} activeTool={activeTool} onTouchStart={handleMouseDown}/>
|
|
831
|
+
|
|
832
|
+
{activeTool === "ruler" && (<>
|
|
833
|
+
<g id="horizontal-ruler">
|
|
834
|
+
<rect x="0" y="0" width={window.innerWidth} height="30" fill="#e0e0e0"/>
|
|
835
|
+
<g stroke="#888" font-size="10" text-anchor="middle">
|
|
836
|
+
{Array.from({ length: window.innerWidth / 50 }, (_, i) => (<g key={i}>
|
|
837
|
+
<line x1={i * 50} y1="0" x2={i * 50} y2="10"/>
|
|
838
|
+
<text x={i * 50} y="15">
|
|
839
|
+
{i * 50}
|
|
840
|
+
</text>
|
|
841
|
+
</g>))}
|
|
842
|
+
</g>
|
|
843
|
+
</g>
|
|
844
|
+
<g id="vertical-ruler">
|
|
845
|
+
<rect x="0" y="0" width="30" height={window.innerHeight} fill="#e0e0e0"/>
|
|
846
|
+
<g stroke="#888" font-size="10" text-anchor="middle">
|
|
847
|
+
{Array.from({ length: window.innerHeight / 10 }, (_, i) => (<g key={i}>
|
|
848
|
+
<line x1="0" y1={i * 50} x2="10" y2={i * 50}/>
|
|
849
|
+
<text x="15" y={i * 50}>
|
|
850
|
+
{i * 50}
|
|
851
|
+
</text>
|
|
852
|
+
</g>))}
|
|
853
|
+
</g>
|
|
854
|
+
</g>
|
|
855
|
+
</>)}
|
|
856
|
+
{grid && (<g stroke="#ddd" strokeWidth={0.5}>
|
|
857
|
+
{/* Vertical lines */}
|
|
858
|
+
{Array.from({ length: widthBoard / 10 }, (_, i) => (<line key={`v-${i}`} x1={i * 10} y1={0} x2={i * 10} y2={heightBoard}/>))}
|
|
859
|
+
|
|
860
|
+
{/* Horizontal lines */}
|
|
861
|
+
{Array.from({ length: heightBoard / 10 }, (_, i) => (<line key={`h-${i}`} x1={0} y1={i * 10} x2={widthBoard} y2={i * 10}/>))}
|
|
862
|
+
</g>)}
|
|
863
|
+
</svg>
|
|
864
|
+
</TransformComponent>
|
|
865
|
+
</TransformWrapper>
|
|
866
|
+
</div>
|
|
867
|
+
</>);
|
|
806
868
|
};
|
|
807
869
|
export default BoardTemplate;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
interface BoardTemplateProps {
|
|
2
3
|
onSelectComponent?: (items: any) => void;
|
|
3
4
|
mappingKey?: string;
|
|
4
5
|
viewOnly?: boolean;
|
|
5
6
|
}
|
|
6
|
-
declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) =>
|
|
7
|
+
declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) => React.JSX.Element;
|
|
7
8
|
export default BoardTemplate;
|
|
8
9
|
export declare function getTranslate(el: any): {
|
|
9
10
|
x: number;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
4
3
|
import { TransformWrapper, TransformComponent, } from "react-zoom-pan-pinch";
|
|
5
4
|
import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
|
|
6
5
|
import Layers from "../../components/layer-v3";
|
|
@@ -1551,54 +1550,133 @@ const BoardTemplate = ({ onSelectComponent, viewOnly }) => {
|
|
|
1551
1550
|
//lin helper from start to move
|
|
1552
1551
|
}
|
|
1553
1552
|
};
|
|
1554
|
-
return (
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1553
|
+
return (<>
|
|
1554
|
+
<ModalPreview>
|
|
1555
|
+
<LayerView statusKey="status"/>
|
|
1556
|
+
</ModalPreview>
|
|
1557
|
+
{touch && <Button onClick={() => setTouch(false)}>Stop Touch</Button>}
|
|
1558
|
+
<div className="relative w-full h-screen flex-1 overflow-hidden" ref={containerRef}>
|
|
1559
|
+
<div className="absolute bottom-5 left-1/2 transform -translate-x-1/2 z-10">
|
|
1560
|
+
<div className="flex gap-2">
|
|
1561
|
+
<Button icon={<ZoomIn />} onClick={handelZoomIn}/>
|
|
1562
|
+
<Button icon={<ZoomOut />} onClick={handleZoomOut}/>
|
|
1563
|
+
</div>
|
|
1564
|
+
</div>
|
|
1565
|
+
<TransformWrapper ref={transformRef} panning={{
|
|
1566
|
+
disabled: [
|
|
1567
|
+
"node",
|
|
1568
|
+
"select",
|
|
1569
|
+
"square",
|
|
1570
|
+
"circle",
|
|
1571
|
+
"table-seat-circle",
|
|
1572
|
+
].includes(activeTool),
|
|
1573
|
+
}} centerZoomedOut={true}
|
|
1574
|
+
// onTransformed={handleTransformed}
|
|
1575
|
+
minScale={0.1} // sangat kecil = bisa zoom out jauh
|
|
1576
|
+
maxScale={1000} initialScale={scale} pinch={{ step: 1 }} wheel={{ disabled: true }} smooth={true} doubleClick={{ step: 1, disabled: activeTool === "select" }} disablePadding centerOnInit>
|
|
1577
|
+
{/* {scale !== 1 && ( */}
|
|
1578
|
+
<div className="absolute bottom-[60px] left-1/2 transform -translate-x-1/2 z-10">
|
|
1579
|
+
{/* {renderMiniMap()} */}
|
|
1580
|
+
</div>
|
|
1581
|
+
{/* )} */}
|
|
1582
|
+
<TransformComponent wrapperStyle={{
|
|
1583
|
+
width: "100%",
|
|
1584
|
+
height: "100%",
|
|
1585
|
+
}} contentStyle={{ width: boardSize.width, height: boardSize.height }}>
|
|
1586
|
+
{isLoading && (<div className="absolute z-20 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
|
|
1587
|
+
Loading...
|
|
1588
|
+
</div>)}
|
|
1589
|
+
<svg id="workspace" ref={svgRef} width={boardSize.width} height={boardSize.height} viewBox={`${minCoords.x} ${minCoords.y} ${boardSize.width} ${boardSize.height}`}
|
|
1590
|
+
// viewBox={`0 0 ${widthBoard} ${heightBoard}`}
|
|
1591
|
+
// className="h-screen"
|
|
1592
|
+
// onMouseUp={handleMouseUp}
|
|
1593
|
+
// onPointerMove={handleMouseMove}
|
|
1594
|
+
onPointerDown={handlePointerDown} onPointerMove={handlePointerMove}
|
|
1595
|
+
// onMouseEnter={handleMouseEnter}
|
|
1596
|
+
// onMouseUp={handleEnd}
|
|
1597
|
+
// onTouchMove={handleMouseMove}
|
|
1598
|
+
// onTouchEnd={handleMouseUp}
|
|
1599
|
+
// onClick={(e) => {
|
|
1600
|
+
// e.stopPropagation();
|
|
1601
|
+
// handleMouseClick(e);
|
|
1602
|
+
// }}
|
|
1603
|
+
// onMouseLeave={handleMouseLeave}
|
|
1604
|
+
xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style={{
|
|
1605
|
+
// background: backgroundColor,
|
|
1606
|
+
background: "black",
|
|
1607
|
+
display: "block",
|
|
1608
|
+
cursor: activeTool === "ruler" ? "crosshair" : "auto",
|
|
1609
|
+
touchAction: "none",
|
|
1610
|
+
pointerEvents: "all",
|
|
1611
|
+
userSelect: "none",
|
|
1612
|
+
}}>
|
|
1613
|
+
<Layers shadowShape={shadowShape} components={[
|
|
1614
|
+
...extraComponentsState,
|
|
1615
|
+
...componentsState,
|
|
1616
|
+
polygonElementRef === null || polygonElementRef === void 0 ? void 0 : polygonElementRef.current,
|
|
1617
|
+
]} style={{
|
|
1618
|
+
cursor: getCursorStyle(),
|
|
1619
|
+
}}
|
|
1620
|
+
// onClick={handleSelectComponent}
|
|
1621
|
+
// onMouseDown={handleMouseDown}
|
|
1622
|
+
// onMouseUp={handleMouseUp}
|
|
1623
|
+
// onBlur={handleUnSelectComponent}
|
|
1624
|
+
selectedComponent={selectedComponent} selectionLines={selectedLines} activeTool={activeTool}/>
|
|
1625
|
+
{/* <polygon
|
|
1626
|
+
points={nodes.map((n) => `${n.x},${n.y}`).join(" ")}
|
|
1627
|
+
fill="transparent"
|
|
1628
|
+
stroke="blue"
|
|
1629
|
+
/> */}
|
|
1630
|
+
{/* Nodes */}
|
|
1631
|
+
{/* {nodes.map((node, index) => (
|
|
1632
|
+
<circle
|
|
1633
|
+
key={index}
|
|
1634
|
+
cx={node.x}
|
|
1635
|
+
cy={node.y}
|
|
1636
|
+
r={10}
|
|
1637
|
+
fill="red"
|
|
1638
|
+
onMouseDown={onTouchStartLine}
|
|
1639
|
+
onTouchStart={onTouchStartLine}
|
|
1640
|
+
onTouchEnd={onTouchEndLine}
|
|
1641
|
+
/>
|
|
1642
|
+
))} */}
|
|
1643
|
+
{activeTool === "polygon" && (<polyline id="polyline-helper" stroke="white" fill="transparent" strokeWidth={2}/>)}
|
|
1644
|
+
{activeTool === "ruler" && (<>
|
|
1645
|
+
<g id="horizontal-ruler">
|
|
1646
|
+
<rect x="0" y="0" width={window.innerWidth} height="30" fill="#e0e0e0"/>
|
|
1647
|
+
<g stroke="#888" font-size="10" text-anchor="middle">
|
|
1648
|
+
{Array.from({ length: window.innerWidth / 50 }, (_, i) => (<g key={i}>
|
|
1649
|
+
<line x1={i * 50} y1="0" x2={i * 50} y2="10"/>
|
|
1650
|
+
<text x={i * 50} y="15">
|
|
1651
|
+
{i * 50}
|
|
1652
|
+
</text>
|
|
1653
|
+
</g>))}
|
|
1654
|
+
</g>
|
|
1655
|
+
</g>
|
|
1656
|
+
<g id="vertical-ruler">
|
|
1657
|
+
<rect x="0" y="0" width="30" height={window.innerHeight} fill="#e0e0e0"/>
|
|
1658
|
+
<g stroke="#888" font-size="10" text-anchor="middle">
|
|
1659
|
+
{Array.from({ length: window.innerHeight / 10 }, (_, i) => (<g key={i}>
|
|
1660
|
+
<line x1="0" y1={i * 50} x2="10" y2={i * 50}/>
|
|
1661
|
+
<text x="15" y={i * 50}>
|
|
1662
|
+
{i * 50}
|
|
1663
|
+
</text>
|
|
1664
|
+
</g>))}
|
|
1665
|
+
</g>
|
|
1666
|
+
</g>
|
|
1667
|
+
</>)}
|
|
1668
|
+
{grid && (<g stroke="#ddd" strokeWidth={0.5}>
|
|
1669
|
+
{/* Vertical lines */}
|
|
1670
|
+
{Array.from({ length: widthBoard / (10 * scale) }, (_, i) => (<line key={`v-${i}`} x1={i * 10 * scale} y1={0} x2={i * 10 * scale} y2={heightBoard}/>))}
|
|
1671
|
+
|
|
1672
|
+
{/* Horizontal lines */}
|
|
1673
|
+
{Array.from({ length: heightBoard / (10 * scale) }, (_, i) => (<line key={`h-${i}`} x1={0} y1={i * 10 * scale} x2={widthBoard} y2={i * 10 * scale}/>))}
|
|
1674
|
+
</g>)}
|
|
1675
|
+
</svg>
|
|
1676
|
+
</TransformComponent>
|
|
1677
|
+
</TransformWrapper>
|
|
1678
|
+
</div>
|
|
1679
|
+
</>);
|
|
1602
1680
|
};
|
|
1603
1681
|
export default BoardTemplate;
|
|
1604
1682
|
function getGlobalBBox(svg, el) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
interface BoardTemplateProps {
|
|
2
3
|
onSelectComponent?: (items: any) => void;
|
|
3
4
|
mappingKey?: string;
|
|
4
5
|
viewOnly?: boolean;
|
|
5
6
|
}
|
|
6
|
-
declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) =>
|
|
7
|
+
declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) => React.JSX.Element;
|
|
7
8
|
export default BoardTemplate;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
4
3
|
import { TransformWrapper, TransformComponent, } from "react-zoom-pan-pinch";
|
|
5
4
|
import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
|
|
6
5
|
import Layers from "../../components/layer-v3";
|
|
@@ -1513,35 +1512,114 @@ const BoardTemplate = ({ onSelectComponent, viewOnly }) => {
|
|
|
1513
1512
|
//lin helper from start to move
|
|
1514
1513
|
}
|
|
1515
1514
|
};
|
|
1516
|
-
return (
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1515
|
+
return (<>
|
|
1516
|
+
<ModalPreview>
|
|
1517
|
+
<LayerView statusKey="status"/>
|
|
1518
|
+
</ModalPreview>
|
|
1519
|
+
{/* {touch && <Button onClick={() => setTouch(false)}>Stop Touch</Button>} */}
|
|
1520
|
+
<div className="relative w-full h-screen flex-1 overflow-hidden" ref={containerRef}>
|
|
1521
|
+
<div className="absolute bottom-5 left-1/2 transform -translate-x-1/2 z-10">
|
|
1522
|
+
<div className="flex gap-2">
|
|
1523
|
+
<Button icon={<ZoomIn />} onClick={handelZoomIn}/>
|
|
1524
|
+
<Button icon={<ZoomOut />} onClick={handleZoomOut}/>
|
|
1525
|
+
</div>
|
|
1526
|
+
</div>
|
|
1527
|
+
<TransformWrapper ref={transformRef}
|
|
1528
|
+
// limitToBounds={true}
|
|
1529
|
+
panning={{
|
|
1530
|
+
disabled: [
|
|
1531
|
+
"node",
|
|
1532
|
+
"select",
|
|
1533
|
+
"square",
|
|
1534
|
+
"circle",
|
|
1535
|
+
"table-seat-circle",
|
|
1536
|
+
].includes(activeTool),
|
|
1537
|
+
}}
|
|
1538
|
+
// centerZoomedOut={true}
|
|
1539
|
+
// onTransformed={handleTransformed}
|
|
1540
|
+
minScale={0.1} // sangat kecil = bisa zoom out jauh
|
|
1541
|
+
maxScale={1000} initialScale={scale} pinch={{ step: 1 }} wheel={{ disabled: true }} smooth={true} doubleClick={{ step: 1, disabled: activeTool === "select" }} disablePadding centerOnInit>
|
|
1542
|
+
{/* {scale !== 1 && ( */}
|
|
1543
|
+
{/* <div className="absolute bottom-[60px] left-1/2 transform -translate-x-1/2 z-10"> */}
|
|
1544
|
+
{/* {renderMiniMap()} */}
|
|
1545
|
+
{/* </div> */}
|
|
1546
|
+
{/* )} */}
|
|
1547
|
+
<TransformComponent wrapperStyle={{
|
|
1548
|
+
width: "100%",
|
|
1549
|
+
height: "100%",
|
|
1550
|
+
}} contentStyle={{ width: boardSize.width, height: boardSize.height }}>
|
|
1551
|
+
{isLoading && (<div className="absolute z-20 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
|
|
1552
|
+
Loading...
|
|
1553
|
+
</div>)}
|
|
1554
|
+
<svg id="workspace" ref={svgRef} width={boardSize.width} height={boardSize.height} viewBox={`${minCoords.x} ${minCoords.y} ${boardSize.width} ${boardSize.height}`} onPointerDown={handlePointerDown} onPointerMove={handlePointerMove} xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style={{
|
|
1555
|
+
background: backgroundColor,
|
|
1556
|
+
display: "block",
|
|
1557
|
+
cursor: activeTool === "ruler" ? "crosshair" : "auto",
|
|
1558
|
+
touchAction: "none",
|
|
1559
|
+
pointerEvents: "all",
|
|
1560
|
+
userSelect: "none",
|
|
1561
|
+
}}>
|
|
1562
|
+
<Layers shadowShape={shadowShape} components={[
|
|
1563
|
+
...extraComponentsState,
|
|
1564
|
+
...componentsState,
|
|
1565
|
+
polygonElementRef === null || polygonElementRef === void 0 ? void 0 : polygonElementRef.current,
|
|
1566
|
+
]} style={{
|
|
1567
|
+
cursor: getCursorStyle(),
|
|
1568
|
+
}} selectedComponent={selectedComponent} selectionLines={selectedLines} activeTool={activeTool}/>
|
|
1569
|
+
{/* <polygon
|
|
1570
|
+
points={nodes.map((n) => `${n.x},${n.y}`).join(" ")}
|
|
1571
|
+
fill="transparent"
|
|
1572
|
+
stroke="blue"
|
|
1573
|
+
/> */}
|
|
1574
|
+
{/* Nodes */}
|
|
1575
|
+
{/* {nodes.map((node, index) => (
|
|
1576
|
+
<circle
|
|
1577
|
+
key={index}
|
|
1578
|
+
cx={node.x}
|
|
1579
|
+
cy={node.y}
|
|
1580
|
+
r={10}
|
|
1581
|
+
fill="red"
|
|
1582
|
+
onMouseDown={onTouchStartLine}
|
|
1583
|
+
onTouchStart={onTouchStartLine}
|
|
1584
|
+
onTouchEnd={onTouchEndLine}
|
|
1585
|
+
/>
|
|
1586
|
+
))} */}
|
|
1587
|
+
{activeTool === "polygon" && (<polyline id="polyline-helper" stroke="#4a90e2" fill="transparent" strokeWidth={2}/>)}
|
|
1588
|
+
{activeTool === "ruler" && (<>
|
|
1589
|
+
<g id="horizontal-ruler">
|
|
1590
|
+
<rect x="0" y="0" width={window.innerWidth} height="30" fill="#e0e0e0"/>
|
|
1591
|
+
<g stroke="#888" font-size="10" text-anchor="middle">
|
|
1592
|
+
{Array.from({ length: window.innerWidth / 50 }, (_, i) => (<g key={i}>
|
|
1593
|
+
<line x1={i * 50} y1="0" x2={i * 50} y2="10"/>
|
|
1594
|
+
<text x={i * 50} y="15">
|
|
1595
|
+
{i * 50}
|
|
1596
|
+
</text>
|
|
1597
|
+
</g>))}
|
|
1598
|
+
</g>
|
|
1599
|
+
</g>
|
|
1600
|
+
<g id="vertical-ruler">
|
|
1601
|
+
<rect x="0" y="0" width="30" height={window.innerHeight} fill="#e0e0e0"/>
|
|
1602
|
+
<g stroke="#888" font-size="10" text-anchor="middle">
|
|
1603
|
+
{Array.from({ length: window.innerHeight / 10 }, (_, i) => (<g key={i}>
|
|
1604
|
+
<line x1="0" y1={i * 50} x2="10" y2={i * 50}/>
|
|
1605
|
+
<text x="15" y={i * 50}>
|
|
1606
|
+
{i * 50}
|
|
1607
|
+
</text>
|
|
1608
|
+
</g>))}
|
|
1609
|
+
</g>
|
|
1610
|
+
</g>
|
|
1611
|
+
</>)}
|
|
1612
|
+
{grid && (<g stroke="#ddd" strokeWidth={0.5}>
|
|
1613
|
+
{/* Vertical lines */}
|
|
1614
|
+
{Array.from({ length: widthBoard / (10 * scale) }, (_, i) => (<line key={`v-${i}`} x1={i * 10 * scale} y1={0} x2={i * 10 * scale} y2={heightBoard}/>))}
|
|
1615
|
+
|
|
1616
|
+
{/* Horizontal lines */}
|
|
1617
|
+
{Array.from({ length: heightBoard / (10 * scale) }, (_, i) => (<line key={`h-${i}`} x1={0} y1={i * 10 * scale} x2={widthBoard} y2={i * 10 * scale}/>))}
|
|
1618
|
+
</g>)}
|
|
1619
|
+
</svg>
|
|
1620
|
+
</TransformComponent>
|
|
1621
|
+
</TransformWrapper>
|
|
1622
|
+
</div>
|
|
1623
|
+
</>);
|
|
1546
1624
|
};
|
|
1547
1625
|
export default BoardTemplate;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const Navbar: () => import("react
|
|
1
|
+
declare const Navbar: () => import("react").JSX.Element;
|
|
2
2
|
export default Navbar;
|
|
@@ -27,5 +27,5 @@ export interface TableEditorProps {
|
|
|
27
27
|
extraComponent: boolean;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
declare const TableEditor: (props: TableEditorProps) => import("react
|
|
30
|
+
declare const TableEditor: (props: TableEditorProps) => import("react").JSX.Element;
|
|
31
31
|
export default TableEditor;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
2
|
import { useEffect, useState } from "react";
|
|
4
3
|
import Board from "../board-v3";
|
|
5
4
|
import SideTool from "../side-tool";
|
|
@@ -95,10 +94,21 @@ const TableEditor = (props) => {
|
|
|
95
94
|
dispatch({ type: "board/setFlagChange", payload: true });
|
|
96
95
|
}
|
|
97
96
|
}, [componentProps, extraComponentProps, props === null || props === void 0 ? void 0 : props.defaultBackground]);
|
|
98
|
-
return (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
return (<>
|
|
98
|
+
<div className="w-full h-screen flex relative">
|
|
99
|
+
<div className="w-full h-full flex relative" style={{
|
|
100
|
+
display: !viewOnly ? "none" : "flex",
|
|
101
|
+
}}>
|
|
102
|
+
<LayerView statusKey="status"/>
|
|
103
|
+
</div>
|
|
104
|
+
<div className="w-full h-full flex relative" style={{
|
|
105
|
+
display: viewOnly ? "none" : "flex",
|
|
106
|
+
}}>
|
|
107
|
+
<SideTool dragOnly={dragOnly} deleteAutorized={deleteAutorized}/>
|
|
108
|
+
<Board onSelectComponent={props.onSelectComponent} viewOnly={viewOnly}/>
|
|
109
|
+
<ControlPanels action={props.action} responseMapping={props.responseMapping}/>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</>);
|
|
103
113
|
};
|
|
104
114
|
export default TableEditor;
|
|
@@ -7,5 +7,5 @@ interface ControlPanelsProps {
|
|
|
7
7
|
src: string;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
declare const ControlPanels: (props: ControlPanelsProps) => import("react
|
|
10
|
+
declare const ControlPanels: (props: ControlPanelsProps) => import("react").JSX.Element;
|
|
11
11
|
export default ControlPanels;
|