@layoutit/polycss-react 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -84,6 +84,7 @@ export default function App() {
84
84
  - `autoCenter` shifts the mesh bbox center to local origin.
85
85
  - `meshResolution` chooses `"lossy"` (default) or `"lossless"` optimization. STL imports use the conservative lossless path in both modes.
86
86
  - `castShadow` emits CSS-projected shadows in dynamic lighting mode.
87
+ - Tooling can reuse `buildPolyMeshTransform`, `worldPositionToPolyCss`, and `worldDirectionToPolyCss` for renderer-compatible transforms.
87
88
 
88
89
  ### Controls
89
90
 
package/dist/index.cjs CHANGED
@@ -63,6 +63,7 @@ __export(src_exports, {
63
63
  bakeSolidTextureSampledPolygons: () => import_polycss_core27.bakeSolidTextureSampledPolygons,
64
64
  bakeSolidTextureSamples: () => import_polycss_core27.bakeSolidTextureSamples,
65
65
  boxPolygons: () => import_polycss_core27.boxPolygons,
66
+ buildPolyMeshTransform: () => import_polycss_core27.buildPolyMeshTransform,
66
67
  buildSceneContext: () => import_polycss_core27.buildSceneContext,
67
68
  cameraCullNormalGroups: () => import_polycss_core27.cameraCullNormalGroups,
68
69
  cameraCullNormalGroupsFromPolygons: () => import_polycss_core27.cameraCullNormalGroupsFromPolygons,
@@ -131,7 +132,9 @@ __export(src_exports, {
131
132
  usePolyMesh: () => usePolyMesh,
132
133
  usePolySceneContext: () => usePolySceneContext,
133
134
  usePolySelect: () => usePolySelect,
134
- usePolySelectionApi: () => usePolySelectionApi
135
+ usePolySelectionApi: () => usePolySelectionApi,
136
+ worldDirectionToPolyCss: () => import_polycss_core27.worldDirectionToCss,
137
+ worldPositionToPolyCss: () => import_polycss_core27.worldPositionToCss
135
138
  });
136
139
  module.exports = __toCommonJS(src_exports);
137
140
 
@@ -3699,27 +3702,6 @@ function solidPaintVars(defaults) {
3699
3702
  }
3700
3703
  return Object.keys(out).length > 0 ? out : null;
3701
3704
  }
3702
- function buildTransform(position, scale, rotation) {
3703
- const sx = typeof scale === "number" ? scale : scale?.[0] ?? 1;
3704
- const sy = typeof scale === "number" ? scale : scale?.[1] ?? 1;
3705
- const sz = typeof scale === "number" ? scale : scale?.[2] ?? 1;
3706
- const hasScale = sx !== 1 || sy !== 1 || sz !== 1;
3707
- const hasRotation = !!rotation && (!!rotation[0] || !!rotation[1] || !!rotation[2]);
3708
- const cssPos = position ? [position[1] * import_polycss_core16.BASE_TILE, position[0] * import_polycss_core16.BASE_TILE, position[2] * import_polycss_core16.BASE_TILE] : [0, 0, 0];
3709
- const parts = [];
3710
- if (cssPos[0] !== 0 || cssPos[1] !== 0 || cssPos[2] !== 0) {
3711
- parts.push(`translate3d(${cssPos[0]}px, ${cssPos[1]}px, ${cssPos[2]}px)`);
3712
- }
3713
- if (hasRotation) {
3714
- if (rotation[0]) parts.push(`rotateY(${-rotation[0]}deg)`);
3715
- if (rotation[1]) parts.push(`rotateX(${-rotation[1]}deg)`);
3716
- if (rotation[2]) parts.push(`rotateZ(${-rotation[2]}deg)`);
3717
- }
3718
- if (hasScale) {
3719
- parts.push(`scale3d(${sx}, ${sy}, ${sz})`);
3720
- }
3721
- return parts.length > 0 ? parts.join(" ") : void 0;
3722
- }
3723
3705
  function recenterPolygons(polygons) {
3724
3706
  if (polygons.length === 0) return polygons;
3725
3707
  const bbox = (0, import_polycss_core16.computeSceneBbox)(polygons);
@@ -3807,7 +3789,7 @@ var PolyMesh = (0, import_react16.forwardRef)(function PolyMesh2({
3807
3789
  () => autoCenter ? recenterPolygons(sourcePolygons) : sourcePolygons,
3808
3790
  [sourcePolygons, autoCenter]
3809
3791
  );
3810
- const transform = buildTransform(position, scale, rotation);
3792
+ const transform = (0, import_polycss_core16.buildPolyMeshTransform)({ position, scale, rotation });
3811
3793
  const wrapperRef = (0, import_react16.useRef)(null);
3812
3794
  const propsRef = (0, import_react16.useRef)({ position, scale, rotation });
3813
3795
  propsRef.current = { position, scale, rotation };
@@ -7309,6 +7291,7 @@ var import_polycss_core27 = require("@layoutit/polycss-core");
7309
7291
  bakeSolidTextureSampledPolygons,
7310
7292
  bakeSolidTextureSamples,
7311
7293
  boxPolygons,
7294
+ buildPolyMeshTransform,
7312
7295
  buildSceneContext,
7313
7296
  cameraCullNormalGroups,
7314
7297
  cameraCullNormalGroupsFromPolygons,
@@ -7377,5 +7360,7 @@ var import_polycss_core27 = require("@layoutit/polycss-core");
7377
7360
  usePolyMesh,
7378
7361
  usePolySceneContext,
7379
7362
  usePolySelect,
7380
- usePolySelectionApi
7363
+ usePolySelectionApi,
7364
+ worldDirectionToPolyCss,
7365
+ worldPositionToPolyCss
7381
7366
  });
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@ import React__default, { ReactNode, CSSProperties, MouseEventHandler, PointerEve
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as _layoutit_polycss_core from '@layoutit/polycss-core';
5
5
  import { Vec3, CameraState, CameraHandle, Vec2, PolyMaterial, PolyDirectionalLight, PolyTextureLightingMode, TextureQuality, Polygon, PolyAmbientLight, PolySeamBleed, PolyRenderStrategiesOption, LoadMeshOptions, ParseResult, MeshResolution, BoxPolygonsOptions, ConePolygonsOptions, CylinderPolygonsOptions, DodecahedronPolygonsOptions, IcosahedronPolygonsOptions, OctahedronPolygonsOptions, PlanePolygonsOptions, RingPolygonsOptions, SpherePolygonsOptions, TetrahedronPolygonsOptions, TorusPolygonsOptions, PolyAnimationTarget, PolyAnimationMixer, PolyAnimationClip, PolyAnimationAction, ParseAnimationController } from '@layoutit/polycss-core';
6
- export { ArrowPolygonsOptions, AutoRotateConfig, AutoRotateOption, AxesHelperOptions, BASE_TILE, BoxFace, BoxFaceOptions, BoxPolygonsOptions, CAMERA_BACKFACE_CULL_EPS, CameraCullNormalGroup, CameraCullRotation, CameraHandle, CameraState, CameraStyleInput, ConePolygonsOptions, CoverPlanarPolygonsOptions, CullInteriorOptions, CylinderPolygonsOptions, DEFAULT_CAMERA_STATE, DEFAULT_PROJECTION, DEFAULT_SEAM_FACET_SPLIT_OPTIONS, DEFAULT_SEAM_OVERLAP_OPTIONS, DodecahedronPolygonsOptions, GltfParseOptions, IcosahedronPolygonsOptions, LoadMeshOptions, LoopMode, LoopOnce, LoopPingPong, LoopRepeat, MeshResolution, MtlParseResult, NormalizeResult, ObjParseOptions, OctahedronPolygonsOptions, OptimizeAnimatedMeshPolygonsOptions, OptimizeMeshParseResultOptions, OptimizeMeshPolygonsOptions, ParseAnimationClip, ParseAnimationController, ParseResult, ParseStlColor, ParseStlSolid, ParseStlTopology, ParsedColor, PlanePolygonsOptions, PolyAmbientLight, PolyAnimationAction, PolyAnimationClip, PolyAnimationMixer, PolyAnimationTarget, PolyDirectionalLight, PolyMaterial, PolyRenderStrategiesOption, PolyRenderStrategy, PolyTextureLightingMode, Polygon, PolygonFace, RingPolygonsOptions, SceneBbox, SceneContext, SceneContextBuildArgs, SceneContextBuildResult, SeamFacetSplitCandidate, SeamFacetSplitCandidateReason, SeamFacetSplitOptions, SeamFacetSplitReport, SeamOverlapCandidate, SeamOverlapCandidateKind, SeamOverlapDiagnostics, SeamOverlapOptions, SimplifyTriangleMeshPolygonsOptions, SolidTextureSampleOptions, StlParseOptions, TetrahedronPolygonsOptions, TexturePaintMetrics, TexturePaintMetricsOptions, TextureTriangle, TorusPolygonsOptions, VOXEL_CAMERA_CULL_AXIS_EPS, VOXEL_CAMERA_CULL_NORMAL_LIMIT, Vec2, Vec3, VoxParseOptions, arrowPolygons, axesHelperPolygons, bakeSolidTextureSampledPolygons, bakeSolidTextureSamples, boxPolygons, buildSceneContext, cameraCullNormalGroups, cameraCullNormalGroupsFromPolygons, cameraCullNormalKey, cameraCullVisibleSignature, cameraFacingDepth, clampChannel, computeSceneBbox, computeShapeLighting, computeTexturePaintMetrics, conePolygons, coverPlanarPolygons, createIsometricCamera, createPolyAnimationMixer, cullInteriorPolygons, cylinderPolygons, dodecahedronPolygons, formatColor, icosahedronPolygons, inverseRotateVec3, isAxisAlignedSurfaceNormal, isVoxelCameraCullableNormalGroups, loadMesh, mergePolygons, normalFacesCamera, normalizeInvertMultiplier, normalizePolygons, octahedronPolygons, optimizeAnimatedMeshPolygons, optimizeMeshParseResult, optimizeMeshPolygons, parseColor, parseGltf, parseHexColor, parseMtl, parseObj, parsePureColor, parseRgbColor, parseStl, parseVox, planePolygons, polygonCssSurfaceNormal, polygonFaces, polygonFacesCamera, repairMeshSeams, ringPolygons, rotateVec3, seamFacetSplitPolygons, seamFacetSplitReport, seamOverlapDiagnostics, seamOverlapPolygons, seamOverlapReport, shadeColor, simplifyTriangleMeshPolygons, tetrahedronPolygons, torusPolygons } from '@layoutit/polycss-core';
6
+ export { ArrowPolygonsOptions, AutoRotateConfig, AutoRotateOption, AxesHelperOptions, BASE_TILE, BoxFace, BoxFaceOptions, BoxPolygonsOptions, CAMERA_BACKFACE_CULL_EPS, CameraCullNormalGroup, CameraCullRotation, CameraHandle, CameraState, CameraStyleInput, ConePolygonsOptions, CoverPlanarPolygonsOptions, CullInteriorOptions, CylinderPolygonsOptions, DEFAULT_CAMERA_STATE, DEFAULT_PROJECTION, DEFAULT_SEAM_FACET_SPLIT_OPTIONS, DEFAULT_SEAM_OVERLAP_OPTIONS, DodecahedronPolygonsOptions, GltfParseOptions, IcosahedronPolygonsOptions, LoadMeshOptions, LoopMode, LoopOnce, LoopPingPong, LoopRepeat, MeshResolution, MtlParseResult, NormalizeResult, ObjParseOptions, OctahedronPolygonsOptions, OptimizeAnimatedMeshPolygonsOptions, OptimizeMeshParseResultOptions, OptimizeMeshPolygonsOptions, ParseAnimationClip, ParseAnimationController, ParseResult, ParseStlColor, ParseStlSolid, ParseStlTopology, ParsedColor, PlanePolygonsOptions, PolyAmbientLight, PolyAnimationAction, PolyAnimationClip, PolyAnimationMixer, PolyAnimationTarget, PolyDirectionalLight, PolyMaterial, PolyMeshTransformInput, PolyRenderStrategiesOption, PolyRenderStrategy, PolyTextureLightingMode, Polygon, PolygonFace, RingPolygonsOptions, SceneBbox, SceneContext, SceneContextBuildArgs, SceneContextBuildResult, SeamFacetSplitCandidate, SeamFacetSplitCandidateReason, SeamFacetSplitOptions, SeamFacetSplitReport, SeamOverlapCandidate, SeamOverlapCandidateKind, SeamOverlapDiagnostics, SeamOverlapOptions, SimplifyTriangleMeshPolygonsOptions, SolidTextureSampleOptions, StlParseOptions, TetrahedronPolygonsOptions, TexturePaintMetrics, TexturePaintMetricsOptions, TextureTriangle, TorusPolygonsOptions, VOXEL_CAMERA_CULL_AXIS_EPS, VOXEL_CAMERA_CULL_NORMAL_LIMIT, Vec2, Vec3, VoxParseOptions, arrowPolygons, axesHelperPolygons, bakeSolidTextureSampledPolygons, bakeSolidTextureSamples, boxPolygons, buildPolyMeshTransform, buildSceneContext, cameraCullNormalGroups, cameraCullNormalGroupsFromPolygons, cameraCullNormalKey, cameraCullVisibleSignature, cameraFacingDepth, clampChannel, computeSceneBbox, computeShapeLighting, computeTexturePaintMetrics, conePolygons, coverPlanarPolygons, createIsometricCamera, createPolyAnimationMixer, cullInteriorPolygons, cylinderPolygons, dodecahedronPolygons, formatColor, icosahedronPolygons, inverseRotateVec3, isAxisAlignedSurfaceNormal, isVoxelCameraCullableNormalGroups, loadMesh, mergePolygons, normalFacesCamera, normalizeInvertMultiplier, normalizePolygons, octahedronPolygons, optimizeAnimatedMeshPolygons, optimizeMeshParseResult, optimizeMeshPolygons, parseColor, parseGltf, parseHexColor, parseMtl, parseObj, parsePureColor, parseRgbColor, parseStl, parseVox, planePolygons, polygonCssSurfaceNormal, polygonFaces, polygonFacesCamera, repairMeshSeams, ringPolygons, rotateVec3, seamFacetSplitPolygons, seamFacetSplitReport, seamOverlapDiagnostics, seamOverlapPolygons, seamOverlapReport, shadeColor, simplifyTriangleMeshPolygons, tetrahedronPolygons, torusPolygons, worldDirectionToCss as worldDirectionToPolyCss, worldPositionToCss as worldPositionToPolyCss } from '@layoutit/polycss-core';
7
7
 
8
8
  interface PolyPerspectiveCameraProps {
9
9
  zoom?: number;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import React__default, { ReactNode, CSSProperties, MouseEventHandler, PointerEve
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as _layoutit_polycss_core from '@layoutit/polycss-core';
5
5
  import { Vec3, CameraState, CameraHandle, Vec2, PolyMaterial, PolyDirectionalLight, PolyTextureLightingMode, TextureQuality, Polygon, PolyAmbientLight, PolySeamBleed, PolyRenderStrategiesOption, LoadMeshOptions, ParseResult, MeshResolution, BoxPolygonsOptions, ConePolygonsOptions, CylinderPolygonsOptions, DodecahedronPolygonsOptions, IcosahedronPolygonsOptions, OctahedronPolygonsOptions, PlanePolygonsOptions, RingPolygonsOptions, SpherePolygonsOptions, TetrahedronPolygonsOptions, TorusPolygonsOptions, PolyAnimationTarget, PolyAnimationMixer, PolyAnimationClip, PolyAnimationAction, ParseAnimationController } from '@layoutit/polycss-core';
6
- export { ArrowPolygonsOptions, AutoRotateConfig, AutoRotateOption, AxesHelperOptions, BASE_TILE, BoxFace, BoxFaceOptions, BoxPolygonsOptions, CAMERA_BACKFACE_CULL_EPS, CameraCullNormalGroup, CameraCullRotation, CameraHandle, CameraState, CameraStyleInput, ConePolygonsOptions, CoverPlanarPolygonsOptions, CullInteriorOptions, CylinderPolygonsOptions, DEFAULT_CAMERA_STATE, DEFAULT_PROJECTION, DEFAULT_SEAM_FACET_SPLIT_OPTIONS, DEFAULT_SEAM_OVERLAP_OPTIONS, DodecahedronPolygonsOptions, GltfParseOptions, IcosahedronPolygonsOptions, LoadMeshOptions, LoopMode, LoopOnce, LoopPingPong, LoopRepeat, MeshResolution, MtlParseResult, NormalizeResult, ObjParseOptions, OctahedronPolygonsOptions, OptimizeAnimatedMeshPolygonsOptions, OptimizeMeshParseResultOptions, OptimizeMeshPolygonsOptions, ParseAnimationClip, ParseAnimationController, ParseResult, ParseStlColor, ParseStlSolid, ParseStlTopology, ParsedColor, PlanePolygonsOptions, PolyAmbientLight, PolyAnimationAction, PolyAnimationClip, PolyAnimationMixer, PolyAnimationTarget, PolyDirectionalLight, PolyMaterial, PolyRenderStrategiesOption, PolyRenderStrategy, PolyTextureLightingMode, Polygon, PolygonFace, RingPolygonsOptions, SceneBbox, SceneContext, SceneContextBuildArgs, SceneContextBuildResult, SeamFacetSplitCandidate, SeamFacetSplitCandidateReason, SeamFacetSplitOptions, SeamFacetSplitReport, SeamOverlapCandidate, SeamOverlapCandidateKind, SeamOverlapDiagnostics, SeamOverlapOptions, SimplifyTriangleMeshPolygonsOptions, SolidTextureSampleOptions, StlParseOptions, TetrahedronPolygonsOptions, TexturePaintMetrics, TexturePaintMetricsOptions, TextureTriangle, TorusPolygonsOptions, VOXEL_CAMERA_CULL_AXIS_EPS, VOXEL_CAMERA_CULL_NORMAL_LIMIT, Vec2, Vec3, VoxParseOptions, arrowPolygons, axesHelperPolygons, bakeSolidTextureSampledPolygons, bakeSolidTextureSamples, boxPolygons, buildSceneContext, cameraCullNormalGroups, cameraCullNormalGroupsFromPolygons, cameraCullNormalKey, cameraCullVisibleSignature, cameraFacingDepth, clampChannel, computeSceneBbox, computeShapeLighting, computeTexturePaintMetrics, conePolygons, coverPlanarPolygons, createIsometricCamera, createPolyAnimationMixer, cullInteriorPolygons, cylinderPolygons, dodecahedronPolygons, formatColor, icosahedronPolygons, inverseRotateVec3, isAxisAlignedSurfaceNormal, isVoxelCameraCullableNormalGroups, loadMesh, mergePolygons, normalFacesCamera, normalizeInvertMultiplier, normalizePolygons, octahedronPolygons, optimizeAnimatedMeshPolygons, optimizeMeshParseResult, optimizeMeshPolygons, parseColor, parseGltf, parseHexColor, parseMtl, parseObj, parsePureColor, parseRgbColor, parseStl, parseVox, planePolygons, polygonCssSurfaceNormal, polygonFaces, polygonFacesCamera, repairMeshSeams, ringPolygons, rotateVec3, seamFacetSplitPolygons, seamFacetSplitReport, seamOverlapDiagnostics, seamOverlapPolygons, seamOverlapReport, shadeColor, simplifyTriangleMeshPolygons, tetrahedronPolygons, torusPolygons } from '@layoutit/polycss-core';
6
+ export { ArrowPolygonsOptions, AutoRotateConfig, AutoRotateOption, AxesHelperOptions, BASE_TILE, BoxFace, BoxFaceOptions, BoxPolygonsOptions, CAMERA_BACKFACE_CULL_EPS, CameraCullNormalGroup, CameraCullRotation, CameraHandle, CameraState, CameraStyleInput, ConePolygonsOptions, CoverPlanarPolygonsOptions, CullInteriorOptions, CylinderPolygonsOptions, DEFAULT_CAMERA_STATE, DEFAULT_PROJECTION, DEFAULT_SEAM_FACET_SPLIT_OPTIONS, DEFAULT_SEAM_OVERLAP_OPTIONS, DodecahedronPolygonsOptions, GltfParseOptions, IcosahedronPolygonsOptions, LoadMeshOptions, LoopMode, LoopOnce, LoopPingPong, LoopRepeat, MeshResolution, MtlParseResult, NormalizeResult, ObjParseOptions, OctahedronPolygonsOptions, OptimizeAnimatedMeshPolygonsOptions, OptimizeMeshParseResultOptions, OptimizeMeshPolygonsOptions, ParseAnimationClip, ParseAnimationController, ParseResult, ParseStlColor, ParseStlSolid, ParseStlTopology, ParsedColor, PlanePolygonsOptions, PolyAmbientLight, PolyAnimationAction, PolyAnimationClip, PolyAnimationMixer, PolyAnimationTarget, PolyDirectionalLight, PolyMaterial, PolyMeshTransformInput, PolyRenderStrategiesOption, PolyRenderStrategy, PolyTextureLightingMode, Polygon, PolygonFace, RingPolygonsOptions, SceneBbox, SceneContext, SceneContextBuildArgs, SceneContextBuildResult, SeamFacetSplitCandidate, SeamFacetSplitCandidateReason, SeamFacetSplitOptions, SeamFacetSplitReport, SeamOverlapCandidate, SeamOverlapCandidateKind, SeamOverlapDiagnostics, SeamOverlapOptions, SimplifyTriangleMeshPolygonsOptions, SolidTextureSampleOptions, StlParseOptions, TetrahedronPolygonsOptions, TexturePaintMetrics, TexturePaintMetricsOptions, TextureTriangle, TorusPolygonsOptions, VOXEL_CAMERA_CULL_AXIS_EPS, VOXEL_CAMERA_CULL_NORMAL_LIMIT, Vec2, Vec3, VoxParseOptions, arrowPolygons, axesHelperPolygons, bakeSolidTextureSampledPolygons, bakeSolidTextureSamples, boxPolygons, buildPolyMeshTransform, buildSceneContext, cameraCullNormalGroups, cameraCullNormalGroupsFromPolygons, cameraCullNormalKey, cameraCullVisibleSignature, cameraFacingDepth, clampChannel, computeSceneBbox, computeShapeLighting, computeTexturePaintMetrics, conePolygons, coverPlanarPolygons, createIsometricCamera, createPolyAnimationMixer, cullInteriorPolygons, cylinderPolygons, dodecahedronPolygons, formatColor, icosahedronPolygons, inverseRotateVec3, isAxisAlignedSurfaceNormal, isVoxelCameraCullableNormalGroups, loadMesh, mergePolygons, normalFacesCamera, normalizeInvertMultiplier, normalizePolygons, octahedronPolygons, optimizeAnimatedMeshPolygons, optimizeMeshParseResult, optimizeMeshPolygons, parseColor, parseGltf, parseHexColor, parseMtl, parseObj, parsePureColor, parseRgbColor, parseStl, parseVox, planePolygons, polygonCssSurfaceNormal, polygonFaces, polygonFacesCamera, repairMeshSeams, ringPolygons, rotateVec3, seamFacetSplitPolygons, seamFacetSplitReport, seamOverlapDiagnostics, seamOverlapPolygons, seamOverlapReport, shadeColor, simplifyTriangleMeshPolygons, tetrahedronPolygons, torusPolygons, worldDirectionToCss as worldDirectionToPolyCss, worldPositionToCss as worldPositionToPolyCss } from '@layoutit/polycss-core';
7
7
 
8
8
  interface PolyPerspectiveCameraProps {
9
9
  zoom?: number;
package/dist/index.js CHANGED
@@ -2782,6 +2782,7 @@ import {
2782
2782
  } from "react";
2783
2783
  import {
2784
2784
  BASE_TILE as BASE_TILE4,
2785
+ buildPolyMeshTransform,
2785
2786
  buildSharedEdgeMap,
2786
2787
  computeReceiverShadowFaces,
2787
2788
  computeSceneBbox,
@@ -3635,27 +3636,6 @@ function solidPaintVars(defaults) {
3635
3636
  }
3636
3637
  return Object.keys(out).length > 0 ? out : null;
3637
3638
  }
3638
- function buildTransform(position, scale, rotation) {
3639
- const sx = typeof scale === "number" ? scale : scale?.[0] ?? 1;
3640
- const sy = typeof scale === "number" ? scale : scale?.[1] ?? 1;
3641
- const sz = typeof scale === "number" ? scale : scale?.[2] ?? 1;
3642
- const hasScale = sx !== 1 || sy !== 1 || sz !== 1;
3643
- const hasRotation = !!rotation && (!!rotation[0] || !!rotation[1] || !!rotation[2]);
3644
- const cssPos = position ? [position[1] * BASE_TILE4, position[0] * BASE_TILE4, position[2] * BASE_TILE4] : [0, 0, 0];
3645
- const parts = [];
3646
- if (cssPos[0] !== 0 || cssPos[1] !== 0 || cssPos[2] !== 0) {
3647
- parts.push(`translate3d(${cssPos[0]}px, ${cssPos[1]}px, ${cssPos[2]}px)`);
3648
- }
3649
- if (hasRotation) {
3650
- if (rotation[0]) parts.push(`rotateY(${-rotation[0]}deg)`);
3651
- if (rotation[1]) parts.push(`rotateX(${-rotation[1]}deg)`);
3652
- if (rotation[2]) parts.push(`rotateZ(${-rotation[2]}deg)`);
3653
- }
3654
- if (hasScale) {
3655
- parts.push(`scale3d(${sx}, ${sy}, ${sz})`);
3656
- }
3657
- return parts.length > 0 ? parts.join(" ") : void 0;
3658
- }
3659
3639
  function recenterPolygons(polygons) {
3660
3640
  if (polygons.length === 0) return polygons;
3661
3641
  const bbox = computeSceneBbox(polygons);
@@ -3743,7 +3723,7 @@ var PolyMesh = forwardRef(function PolyMesh2({
3743
3723
  () => autoCenter ? recenterPolygons(sourcePolygons) : sourcePolygons,
3744
3724
  [sourcePolygons, autoCenter]
3745
3725
  );
3746
- const transform = buildTransform(position, scale, rotation);
3726
+ const transform = buildPolyMeshTransform({ position, scale, rotation });
3747
3727
  const wrapperRef = useRef6(null);
3748
3728
  const propsRef = useRef6({ position, scale, rotation });
3749
3729
  propsRef.current = { position, scale, rotation };
@@ -7296,6 +7276,7 @@ import {
7296
7276
  torusPolygons as torusPolygons2,
7297
7277
  planePolygons as planePolygons3,
7298
7278
  buildSceneContext as buildSceneContext2,
7279
+ buildPolyMeshTransform as buildPolyMeshTransform2,
7299
7280
  computeSceneBbox as computeSceneBbox2,
7300
7281
  BASE_TILE as BASE_TILE8,
7301
7282
  DEFAULT_CAMERA_STATE as DEFAULT_CAMERA_STATE2,
@@ -7307,7 +7288,9 @@ import {
7307
7288
  DEFAULT_SEAM_OVERLAP_OPTIONS,
7308
7289
  LoopOnce,
7309
7290
  LoopRepeat,
7310
- LoopPingPong
7291
+ LoopPingPong,
7292
+ worldDirectionToCss as worldDirectionToCss3,
7293
+ worldPositionToCss
7311
7294
  } from "@layoutit/polycss-core";
7312
7295
  export {
7313
7296
  BASE_TILE8 as BASE_TILE,
@@ -7353,6 +7336,7 @@ export {
7353
7336
  bakeSolidTextureSampledPolygons,
7354
7337
  bakeSolidTextureSamples,
7355
7338
  boxPolygons2 as boxPolygons,
7339
+ buildPolyMeshTransform2 as buildPolyMeshTransform,
7356
7340
  buildSceneContext2 as buildSceneContext,
7357
7341
  cameraCullNormalGroups,
7358
7342
  cameraCullNormalGroupsFromPolygons,
@@ -7421,5 +7405,7 @@ export {
7421
7405
  usePolyMesh,
7422
7406
  usePolySceneContext,
7423
7407
  usePolySelect,
7424
- usePolySelectionApi
7408
+ usePolySelectionApi,
7409
+ worldDirectionToCss3 as worldDirectionToPolyCss,
7410
+ worldPositionToCss as worldPositionToPolyCss
7425
7411
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layoutit/polycss-react",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "React components for the CSS-based polygon mesh rendering engine",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -41,7 +41,7 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@layoutit/polycss-core": "^0.2.2"
44
+ "@layoutit/polycss-core": "^0.2.3"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "react": "^18.0.0 || ^19.0.0",