diff --git a/AppImage/components/script-terminal-modal.tsx b/AppImage/components/script-terminal-modal.tsx index 1a12ca0..89f9f5e 100644 --- a/AppImage/components/script-terminal-modal.tsx +++ b/AppImage/components/script-terminal-modal.tsx @@ -384,19 +384,20 @@ export function ScriptTerminalModal({ onClose() } - const handleResizeStart = (e: React.PointerEvent) => { + const handleResizeStart = (e: React.MouseEvent | React.TouchEvent) => { e.preventDefault() e.stopPropagation() setIsResizing(true) - const startY = e.clientY + + // Detectar si es touch o mouse + const clientY = "touches" in e ? e.touches[0].clientY : e.clientY + const startY = clientY const startHeight = modalHeight - const handleMove = (moveEvent: PointerEvent) => { - moveEvent.preventDefault() - const currentY = moveEvent.clientY + const handleMove = (moveEvent: MouseEvent | TouchEvent) => { + const currentY = "touches" in moveEvent ? moveEvent.touches[0].clientY : moveEvent.clientY const deltaY = currentY - startY - const newHeight = Math.max(300, Math.min(window.innerHeight - 100, startHeight + deltaY)) setModalHeight(newHeight) @@ -419,34 +420,19 @@ export function ScriptTerminalModal({ const handleEnd = () => { setIsResizing(false) - document.removeEventListener("pointermove", handleMove) - document.removeEventListener("pointerup", handleEnd) - document.removeEventListener("pointercancel", handleEnd) + + document.removeEventListener("mousemove", handleMove as any) + document.removeEventListener("mouseup", handleEnd) + document.removeEventListener("touchmove", handleMove as any) + document.removeEventListener("touchend", handleEnd) localStorage.setItem("scriptModalHeight", modalHeight.toString()) - - // Release pointer capture - if (resizeBarRef.current) { - try { - resizeBarRef.current.releasePointerCapture(e.pointerId) - } catch (err) { - // Ignore if already released - } - } } - document.addEventListener("pointermove", handleMove) - document.addEventListener("pointerup", handleEnd) - document.addEventListener("pointercancel", handleEnd) - - // Capturar el pointer para asegurar que recibimos todos los eventos - if (resizeBarRef.current) { - try { - resizeBarRef.current.setPointerCapture(e.pointerId) - } catch (err) { - // Ignore if capture fails - } - } + document.addEventListener("mousemove", handleMove as any) + document.addEventListener("mouseup", handleEnd) + document.addEventListener("touchmove", handleMove as any, { passive: false }) + document.addEventListener("touchend", handleEnd) } const sendCommand = (command: string) => { @@ -494,19 +480,16 @@ export function ScriptTerminalModal({ {!isMobile && (