Refactor box face UV projection to remove unused import and simplify halfSize calculation

This commit is contained in:
2026-04-05 02:25:42 +02:00
parent 03465d1d84
commit 203aa93137

View File

@@ -2,7 +2,6 @@ import { BoxGeometry } from "three";
import type { Vec2, Vec3 } from "../core/vector";
import { BOX_FACE_IDS, createDefaultFaceUvState, type BoxBrush, type BoxFaceId, type FaceUvState } from "../document/brushes";
import { getBoxBrushHalfSize } from "./box-brush";
interface BoxBrushUvProjectionSource {
size: Vec3;
@@ -45,7 +44,11 @@ export function createFitToFaceBoxBrushFaceUvState(brush: BoxBrush, faceId: BoxF
}
export function projectBoxFaceVertexToUv(vertexPosition: Vec3, brush: BoxBrushUvProjectionSource, faceId: BoxFaceId): Vec2 {
const halfSize = getBoxBrushHalfSize(brush);
const halfSize = {
x: brush.size.x * 0.5,
y: brush.size.y * 0.5,
z: brush.size.z * 0.5
};
switch (faceId) {
case "posX":