Initial commit of my folder

This commit is contained in:
Timothy
2026-03-10 20:41:46 +00:00
parent 37becee76a
commit 7ad88804f3
1225 changed files with 238706 additions and 0 deletions

View File

@ -0,0 +1,36 @@
import React, { useState, useEffect } from 'react';
const VirtualCanvas = ({ surfaces, onVertexMove, onSurfaceSelect }) => {
return (
<div className="relative w-full aspect-video bg-gray-900 border-2 border-gray-700 rounded-lg overflow-hidden cursor-crosshair">
<svg
viewBox="0 0 100 100"
preserveAspectRatio="none"
className="w-full h-full"
>
{surfaces.map((surface, sIndex) => (
<g key={sIndex} onClick={() => onSurfaceSelect(sIndex)}>
<polygon
points={surface.vertices.map(v => `${v.x * 100},${v.y * 100}`).join(' ')}
className={`${
surface.selected ? 'fill-blue-500/50 stroke-blue-400' : 'fill-white/20 stroke-white/50'
} stroke-1 transition-colors duration-200`}
/>
{surface.selected && surface.vertices.map((v, vIndex) => (
<circle
key={vIndex}
cx={v.x * 100}
cy={v.y * 100}
r="1.5"
className="fill-blue-400 stroke-white stroke-[0.2] hover:fill-blue-200 cursor-move"
onMouseDown={(e) => onVertexMove(e, sIndex, vIndex)}
/>
))}
</g>
))}
</svg>
</div>
);
};
export default VirtualCanvas;