seat-editor 1.2.21 → 1.2.23

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.
@@ -1,2 +1,2 @@
1
- declare const OnlyView: () => import("react/jsx-runtime").JSX.Element;
2
- export default OnlyView;
1
+ declare const TouchScrollDetect: () => import("react/jsx-runtime").JSX.Element;
2
+ export default TouchScrollDetect;
@@ -1,16 +1,40 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import LayerView from "@/features/view/index";
3
- import { dataDummy, dummyImage } from "./constant";
4
- const OnlyView = () => {
5
- return (_jsx(_Fragment, { children: _jsx("div", { className: "w-full h-screen flex relative justify-center items-center", children: _jsx(LayerView, { componentProps: dataDummy, mappingKey: "properties", extraComponentProps: dummyImage, statusKey: "status", colorMatchKey: [
6
- {
7
- color: "red",
8
- key: "1",
9
- },
10
- {
11
- color: "blue",
12
- key: "2",
13
- }
14
- ] }) }) }));
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import LayerView from "@/features/view";
4
+ import { useState, useEffect } from "react";
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 (_jsxs("div", { id: "scroll-container", className: "h-screen overflow-y-scroll bg-gray-100 p-6 text-gray-800", children: [_jsx(LayerView, { statusKey: "status", defaultBackground: "#000000" }), _jsxs("div", { className: "sticky top-0 bg-white z-10 py-2", children: [scrollType === "one" && (_jsx("p", { className: "text-blue-600 font-medium", children: "\uD83D\uDC46 One-finger scroll" })), scrollType === "two" && (_jsx("p", { className: "text-green-600 font-medium", children: "\u270C\uFE0F Two-finger scroll" })), scrollType === "other" && (_jsxs("p", { className: "text-red-600 font-medium", children: ["\uD83D\uDD90\uFE0F ", fingerCount, " fingers on screen"] }))] }), _jsx("div", { className: "h-[2000px] bg-white mt-4 rounded p-4 shadow", children: _jsx("p", { children: "Scroll this page with 1 or 2 fingers." }) })] }));
15
39
  };
16
- export default OnlyView;
40
+ export default TouchScrollDetect;
@@ -6,7 +6,7 @@ import { TransformWrapper, TransformComponent, } from "react-zoom-pan-pinch";
6
6
  import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
7
7
  import Layers from "../../components/layer";
8
8
  const LayerView = (props) => {
9
- const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, selectedTableColor, colorMatchKey, statusKey, defaultBackground } = props;
9
+ const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, selectedTableColor, colorMatchKey, statusKey, defaultBackground, } = props;
10
10
  const transformRef = useRef(null);
11
11
  const containerRef = useRef(null);
12
12
  const svgRef = useRef(null);
@@ -126,14 +126,20 @@ const LayerView = (props) => {
126
126
  return finalProps;
127
127
  });
128
128
  };
129
- return (_jsx("div", { className: "relative w-full h-full flex-1", ref: containerRef, children: _jsx(TransformWrapper, Object.assign({ ref: transformRef }, props.transformProps, {
130
- // panning={{
131
- // disabled: false,
132
- // }}
133
- disablePadding: true, centerZoomedOut: true, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1, pinch: { step: 1 }, smooth: true, children: _jsx(TransformComponent, { wrapperStyle: {
129
+ return (_jsx("div", { className: "relative w-full h-full flex-1", ref: containerRef, style: {
130
+ height: "100vh",
131
+ overflow: "auto",
132
+ WebkitOverflowScrolling: "touch",
133
+ touchAction: "pan-y",
134
+ }, children: _jsx(TransformWrapper, Object.assign({ ref: transformRef }, props.transformProps, { panning: {
135
+ disabled: false,
136
+ velocityDisabled: true,
137
+ }, limitToBounds: false, doubleClick: { disabled: true }, pinch: { disabled: false }, wheel: { disabled: true }, disabled: true, disablePadding: true, centerZoomedOut: true, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1,
138
+ // pinch={{ step: 1 }}
139
+ smooth: true, children: _jsx(TransformComponent, { wrapperStyle: {
134
140
  width: "100%",
135
141
  height: "100%",
136
- overflow: "hidden",
142
+ overflow: "visible",
137
143
  }, contentStyle: {
138
144
  width: "100%",
139
145
  height: "100%",
@@ -141,7 +147,7 @@ const LayerView = (props) => {
141
147
  background: backgroundColor,
142
148
  display: "block",
143
149
  pointerEvents: "auto",
144
- touchAction: "none",
150
+ touchAction: "pay-y",
145
151
  }, children: _jsx(Layers, { mode: "view", components: [
146
152
  ...extraComponentsEditor,
147
153
  ...renderElements(componentsEditor, mappingKey, colorMatchKey),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,27 +0,0 @@
1
- import localFont from "next/font/local";
2
- import "./globals.css";
3
- import { Layout } from "antd";
4
- import { StoreProvider } from "../provider/store-provider";
5
- const geistSans = localFont({
6
- src: "./fonts/GeistVF.woff",
7
- variable: "--font-geist-sans",
8
- weight: "100 900",
9
- });
10
- const geistMono = localFont({
11
- src: "./fonts/GeistMonoVF.woff",
12
- variable: "--font-geist-mono",
13
- weight: "100 900",
14
- });
15
- export const metadata = {
16
- title: "Create Next App",
17
- description: "Generated by create next app",
18
- };
19
- export default function RootLayout({ children, }) {
20
- return (<html lang="en">
21
- <body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
22
- <StoreProvider>
23
- <Layout>{children}</Layout>
24
- </StoreProvider>
25
- </body>
26
- </html>);
27
- }
@@ -1,12 +0,0 @@
1
- import Board from "../../features/board";
2
- import SideTool from "../../features/side-tool";
3
- import ControlPanels from "../../features/panel";
4
- export default function NewBoard() {
5
- return (<>
6
- <div className="w-full h-screen flex relative">
7
- <SideTool />
8
- <Board />
9
- <ControlPanels />
10
- </div>
11
- </>);
12
- }