Spaces:
Runtime error
Runtime error
Commit
Β·
c1240dc
1
Parent(s):
d46b5b4
try to avoid the rubberband scroll
Browse files- client/src/app.tsx +12 -3
- client/src/layout.tsx +16 -1
- client/src/styles/globals.css +8 -0
- public/index.js +29 -8
client/src/app.tsx
CHANGED
|
@@ -181,9 +181,18 @@ export function App() {
|
|
| 181 |
onMouseDown={handleMouseDown}
|
| 182 |
onMouseUp={handleMouseUp}
|
| 183 |
onMouseMove={handleMouseMove}
|
| 184 |
-
onTouchStart={
|
| 185 |
-
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
style={{
|
| 188 |
position: 'absolute',
|
| 189 |
top: 0,
|
|
|
|
| 181 |
onMouseDown={handleMouseDown}
|
| 182 |
onMouseUp={handleMouseUp}
|
| 183 |
onMouseMove={handleMouseMove}
|
| 184 |
+
onTouchStart={(e) => {
|
| 185 |
+
e.preventDefault(); // Prevent default touch behavior on canvas
|
| 186 |
+
handleTouchStart(e);
|
| 187 |
+
}}
|
| 188 |
+
onTouchMove={(e) => {
|
| 189 |
+
e.preventDefault(); // Prevent default touch behavior on canvas
|
| 190 |
+
handleTouchMove(e);
|
| 191 |
+
}}
|
| 192 |
+
onTouchEnd={(e) => {
|
| 193 |
+
e.preventDefault(); // Prevent default touch behavior on canvas
|
| 194 |
+
handleTouchEnd(e);
|
| 195 |
+
}}
|
| 196 |
style={{
|
| 197 |
position: 'absolute',
|
| 198 |
top: 0,
|
client/src/layout.tsx
CHANGED
|
@@ -1,6 +1,21 @@
|
|
| 1 |
-
import React, { type ReactNode } from 'react';
|
| 2 |
|
| 3 |
export function Layout({ children }: { children: ReactNode }) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
return (
|
| 5 |
<div className="fixed min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-gray-300 to-stone-300"
|
| 6 |
style={{ boxShadow: "inset 0 0 10vh 0 rgb(0 0 0 / 30%)" }}>
|
|
|
|
| 1 |
+
import React, { type ReactNode, useEffect } from 'react';
|
| 2 |
|
| 3 |
export function Layout({ children }: { children: ReactNode }) {
|
| 4 |
+
useEffect(() => {
|
| 5 |
+
// Prevent default touch behavior
|
| 6 |
+
const preventDefaultTouchBehavior = (e: TouchEvent) => {
|
| 7 |
+
if (e.target instanceof HTMLElement && e.target.tagName !== 'CANVAS') {
|
| 8 |
+
e.preventDefault();
|
| 9 |
+
}
|
| 10 |
+
};
|
| 11 |
+
|
| 12 |
+
document.body.addEventListener('touchmove', preventDefaultTouchBehavior, { passive: false });
|
| 13 |
+
|
| 14 |
+
return () => {
|
| 15 |
+
document.body.removeEventListener('touchmove', preventDefaultTouchBehavior);
|
| 16 |
+
};
|
| 17 |
+
}, []);
|
| 18 |
+
|
| 19 |
return (
|
| 20 |
<div className="fixed min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-gray-300 to-stone-300"
|
| 21 |
style={{ boxShadow: "inset 0 0 10vh 0 rgb(0 0 0 / 30%)" }}>
|
client/src/styles/globals.css
CHANGED
|
@@ -78,4 +78,12 @@
|
|
| 78 |
@apply bg-background text-foreground;
|
| 79 |
font-feature-settings: "rlig" 1, "calt" 1;
|
| 80 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
|
|
|
| 78 |
@apply bg-background text-foreground;
|
| 79 |
font-feature-settings: "rlig" 1, "calt" 1;
|
| 80 |
}
|
| 81 |
+
|
| 82 |
+
html, body {
|
| 83 |
+
position: fixed;
|
| 84 |
+
overflow: hidden;
|
| 85 |
+
width: 100%;
|
| 86 |
+
height: 100%;
|
| 87 |
+
overscroll-behavior: none;
|
| 88 |
+
}
|
| 89 |
}
|
public/index.js
CHANGED
|
@@ -23683,7 +23683,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
| 23683 |
var client = __toESM(require_client(), 1);
|
| 23684 |
|
| 23685 |
// src/app.tsx
|
| 23686 |
-
var
|
| 23687 |
|
| 23688 |
// node_modules/react-icons/lib/iconBase.mjs
|
| 23689 |
var import_react2 = __toESM(require_react(), 1);
|
|
@@ -33469,8 +33469,20 @@ function useFacePokeAPI() {
|
|
| 33469 |
}
|
| 33470 |
|
| 33471 |
// src/layout.tsx
|
|
|
|
| 33472 |
var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
| 33473 |
function Layout({ children }) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33474 |
return jsx_dev_runtime3.jsxDEV("div", {
|
| 33475 |
className: "fixed min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-gray-300 to-stone-300",
|
| 33476 |
style: { boxShadow: "inset 0 0 10vh 0 rgb(0 0 0 / 30%)" },
|
|
@@ -33514,12 +33526,12 @@ function App() {
|
|
| 33514 |
handleTouchEnd,
|
| 33515 |
currentOpacity
|
| 33516 |
} = useFaceLandmarkDetection();
|
| 33517 |
-
const videoRef =
|
| 33518 |
-
const handleFileChange =
|
| 33519 |
const files = event.target.files;
|
| 33520 |
setImageFile(files?.[0] || undefined);
|
| 33521 |
}, [setImageFile]);
|
| 33522 |
-
const handleDownload =
|
| 33523 |
if (previewImage) {
|
| 33524 |
const link = document.createElement("a");
|
| 33525 |
link.href = previewImage;
|
|
@@ -33530,7 +33542,7 @@ function App() {
|
|
| 33530 |
}
|
| 33531 |
}, [previewImage]);
|
| 33532 |
const canDisplayBlendShapes = false;
|
| 33533 |
-
const displayBlendShapes =
|
| 33534 |
className: "mt-4",
|
| 33535 |
children: [
|
| 33536 |
jsx_dev_runtime4.jsxDEV("h3", {
|
|
@@ -33660,9 +33672,18 @@ function App() {
|
|
| 33660 |
onMouseDown: handleMouseDown,
|
| 33661 |
onMouseUp: handleMouseUp,
|
| 33662 |
onMouseMove: handleMouseMove,
|
| 33663 |
-
onTouchStart:
|
| 33664 |
-
|
| 33665 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33666 |
style: {
|
| 33667 |
position: "absolute",
|
| 33668 |
top: 0,
|
|
|
|
| 23683 |
var client = __toESM(require_client(), 1);
|
| 23684 |
|
| 23685 |
// src/app.tsx
|
| 23686 |
+
var import_react10 = __toESM(require_react(), 1);
|
| 23687 |
|
| 23688 |
// node_modules/react-icons/lib/iconBase.mjs
|
| 23689 |
var import_react2 = __toESM(require_react(), 1);
|
|
|
|
| 33469 |
}
|
| 33470 |
|
| 33471 |
// src/layout.tsx
|
| 33472 |
+
var import_react9 = __toESM(require_react(), 1);
|
| 33473 |
var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
| 33474 |
function Layout({ children }) {
|
| 33475 |
+
import_react9.useEffect(() => {
|
| 33476 |
+
const preventDefaultTouchBehavior = (e2) => {
|
| 33477 |
+
if (e2.target instanceof HTMLElement && e2.target.tagName !== "CANVAS") {
|
| 33478 |
+
e2.preventDefault();
|
| 33479 |
+
}
|
| 33480 |
+
};
|
| 33481 |
+
document.body.addEventListener("touchmove", preventDefaultTouchBehavior, { passive: false });
|
| 33482 |
+
return () => {
|
| 33483 |
+
document.body.removeEventListener("touchmove", preventDefaultTouchBehavior);
|
| 33484 |
+
};
|
| 33485 |
+
}, []);
|
| 33486 |
return jsx_dev_runtime3.jsxDEV("div", {
|
| 33487 |
className: "fixed min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-gray-300 to-stone-300",
|
| 33488 |
style: { boxShadow: "inset 0 0 10vh 0 rgb(0 0 0 / 30%)" },
|
|
|
|
| 33526 |
handleTouchEnd,
|
| 33527 |
currentOpacity
|
| 33528 |
} = useFaceLandmarkDetection();
|
| 33529 |
+
const videoRef = import_react10.useRef(null);
|
| 33530 |
+
const handleFileChange = import_react10.useCallback((event) => {
|
| 33531 |
const files = event.target.files;
|
| 33532 |
setImageFile(files?.[0] || undefined);
|
| 33533 |
}, [setImageFile]);
|
| 33534 |
+
const handleDownload = import_react10.useCallback(() => {
|
| 33535 |
if (previewImage) {
|
| 33536 |
const link = document.createElement("a");
|
| 33537 |
link.href = previewImage;
|
|
|
|
| 33542 |
}
|
| 33543 |
}, [previewImage]);
|
| 33544 |
const canDisplayBlendShapes = false;
|
| 33545 |
+
const displayBlendShapes = import_react10.useMemo(() => jsx_dev_runtime4.jsxDEV("div", {
|
| 33546 |
className: "mt-4",
|
| 33547 |
children: [
|
| 33548 |
jsx_dev_runtime4.jsxDEV("h3", {
|
|
|
|
| 33672 |
onMouseDown: handleMouseDown,
|
| 33673 |
onMouseUp: handleMouseUp,
|
| 33674 |
onMouseMove: handleMouseMove,
|
| 33675 |
+
onTouchStart: (e2) => {
|
| 33676 |
+
e2.preventDefault();
|
| 33677 |
+
handleTouchStart(e2);
|
| 33678 |
+
},
|
| 33679 |
+
onTouchMove: (e2) => {
|
| 33680 |
+
e2.preventDefault();
|
| 33681 |
+
handleTouchMove(e2);
|
| 33682 |
+
},
|
| 33683 |
+
onTouchEnd: (e2) => {
|
| 33684 |
+
e2.preventDefault();
|
| 33685 |
+
handleTouchEnd(e2);
|
| 33686 |
+
},
|
| 33687 |
style: {
|
| 33688 |
position: "absolute",
|
| 33689 |
top: 0,
|