feat: Enhance duplication and movement controls with axis constraints and snapping functionality

- Added axis constraint toggling for duplication and movement controls (X and Z axes).
- Implemented snapping functionality for asset positioning based on modifier keys (Ctrl, Shift).
- Created utility functions for handling asset position and rotation snapping.
- Refactored moveControls3D and rotateControls3D to utilize new snapping functions.
- Introduced state management for key events and axis constraints.
- Updated styles for new UI components related to asset filtering and transformation.
- Removed deprecated snapControls utility function.
This commit is contained in:
Nalvazhuthi
2025-08-21 09:57:48 +05:30
20 changed files with 1242 additions and 97 deletions

View File

@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
import Search from "../../ui/inputs/Search";
import { getCategoryAsset } from "../../../services/factoryBuilder/asset/assets/getCategoryAsset";
import { fetchAssets } from "../../../services/marketplace/fetchAssets";
import { useSelectedItem } from "../../../store/builder/store";
import { useDecalStore, useSelectedItem } from "../../../store/builder/store";
// images -------------------
import vehicle from "../../../assets/image/categories/vehicles.png";
@@ -15,6 +15,7 @@ import safety from "../../../assets/image/categories/safety.png";
import feneration from "../../../assets/image/categories/feneration.png";
import decal from "../../../assets/image/categories/decal.png";
import SkeletonUI from "../../templates/SkeletonUI";
import { AlertIcon, DecalInfoIcon, HangTagIcon, NavigationIcon } from "../../icons/ExportCommonIcons";
// -------------------------------------
interface AssetProp {
@@ -113,6 +114,16 @@ const Assets: React.FC = () => {
}
};
const activeSubcategories = [
{ name: "Safety", icon: <AlertIcon /> },
{ name: "Navigation", icon: <NavigationIcon /> },
{ name: "Branding", icon: <HangTagIcon /> },
{ name: "Informational", icon: <DecalInfoIcon /> }
]
const { selectedSubCategory, setSelectedSubCategory } = useDecalStore();
return (
<div className="assets-container-main">
<Search onChange={handleSearchChange} />
@@ -183,6 +194,19 @@ const Assets: React.FC = () => {
Back
</button>
</h2>
{selectedCategory === "Decals" &&
<>
<div className="catogory-asset-filter">
{activeSubcategories.map((cat, index) => (
<div className={`catogory-asset-filter-wrapper ${selectedSubCategory === cat.name ? "active" : ""}`} onClick={() => setSelectedSubCategory(cat.name)}>
<div className="sub-catagory">{cat.icon}</div>
<div className="sub-catagory">{cat.name}</div>
</div>
))}
</div>
</>
}
<div className="assets-container">
{categoryAssets?.map((asset: any, index: number) => (
<div