@tscircuit/3d-viewer 0.0.374 → 0.0.375
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/dist/index.js +29 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14528,7 +14528,8 @@ function MixedStlModel({
|
|
|
14528
14528
|
rotation: rotation2,
|
|
14529
14529
|
onHover,
|
|
14530
14530
|
onUnhover,
|
|
14531
|
-
isHovered
|
|
14531
|
+
isHovered,
|
|
14532
|
+
scale: scale2
|
|
14532
14533
|
}) {
|
|
14533
14534
|
const obj = useGlobalObjLoader(url);
|
|
14534
14535
|
const { rootObject } = useThree();
|
|
@@ -14568,6 +14569,9 @@ function MixedStlModel({
|
|
|
14568
14569
|
model.rotation.copy(rotation2);
|
|
14569
14570
|
}
|
|
14570
14571
|
}
|
|
14572
|
+
if (scale2 !== void 0) {
|
|
14573
|
+
model.scale.setScalar(scale2);
|
|
14574
|
+
}
|
|
14571
14575
|
}, [
|
|
14572
14576
|
model,
|
|
14573
14577
|
Array.isArray(position) ? position[0] : position?.x,
|
|
@@ -14575,7 +14579,8 @@ function MixedStlModel({
|
|
|
14575
14579
|
Array.isArray(position) ? position[2] : position?.z,
|
|
14576
14580
|
Array.isArray(rotation2) ? rotation2[0] : rotation2?.x,
|
|
14577
14581
|
Array.isArray(rotation2) ? rotation2[1] : rotation2?.y,
|
|
14578
|
-
Array.isArray(rotation2) ? rotation2[2] : rotation2?.z
|
|
14582
|
+
Array.isArray(rotation2) ? rotation2[2] : rotation2?.z,
|
|
14583
|
+
scale2
|
|
14579
14584
|
]);
|
|
14580
14585
|
if (obj instanceof Error) {
|
|
14581
14586
|
throw obj;
|
|
@@ -14602,7 +14607,8 @@ function GltfModel({
|
|
|
14602
14607
|
rotation: rotation2,
|
|
14603
14608
|
onHover,
|
|
14604
14609
|
onUnhover,
|
|
14605
|
-
isHovered
|
|
14610
|
+
isHovered,
|
|
14611
|
+
scale: scale2
|
|
14606
14612
|
}) {
|
|
14607
14613
|
const { rootObject } = useThree();
|
|
14608
14614
|
const [model, setModel] = useState3(null);
|
|
@@ -14629,6 +14635,7 @@ function GltfModel({
|
|
|
14629
14635
|
if (!model) return;
|
|
14630
14636
|
if (position) model.position.fromArray(position);
|
|
14631
14637
|
if (rotation2) model.rotation.fromArray(rotation2);
|
|
14638
|
+
if (scale2 !== void 0) model.scale.setScalar(scale2);
|
|
14632
14639
|
}, [
|
|
14633
14640
|
model,
|
|
14634
14641
|
position?.[0],
|
|
@@ -14636,7 +14643,8 @@ function GltfModel({
|
|
|
14636
14643
|
position?.[2],
|
|
14637
14644
|
rotation2?.[0],
|
|
14638
14645
|
rotation2?.[1],
|
|
14639
|
-
rotation2?.[2]
|
|
14646
|
+
rotation2?.[2],
|
|
14647
|
+
scale2
|
|
14640
14648
|
]);
|
|
14641
14649
|
useEffect5(() => {
|
|
14642
14650
|
if (!rootObject || !model) return;
|
|
@@ -16628,6 +16636,7 @@ var cad_component = z101.object({
|
|
|
16628
16636
|
model_glb_url: z101.string().optional(),
|
|
16629
16637
|
model_step_url: z101.string().optional(),
|
|
16630
16638
|
model_wrl_url: z101.string().optional(),
|
|
16639
|
+
model_unit_to_mm_scale_factor: z101.number().optional(),
|
|
16631
16640
|
model_jscad: z101.any().optional()
|
|
16632
16641
|
}).describe("Defines a component on the PCB");
|
|
16633
16642
|
expectTypesMatch(true);
|
|
@@ -25664,7 +25673,8 @@ var JscadModel = ({
|
|
|
25664
25673
|
rotationOffset,
|
|
25665
25674
|
onHover,
|
|
25666
25675
|
onUnhover,
|
|
25667
|
-
isHovered
|
|
25676
|
+
isHovered,
|
|
25677
|
+
scale: scale2
|
|
25668
25678
|
}) => {
|
|
25669
25679
|
const { rootObject } = useThree();
|
|
25670
25680
|
const { threeGeom, material } = useMemo4(() => {
|
|
@@ -25695,6 +25705,7 @@ var JscadModel = ({
|
|
|
25695
25705
|
if (!mesh) return;
|
|
25696
25706
|
if (positionOffset) mesh.position.fromArray(positionOffset);
|
|
25697
25707
|
if (rotationOffset) mesh.rotation.fromArray(rotationOffset);
|
|
25708
|
+
if (scale2 !== void 0) mesh.scale.setScalar(scale2);
|
|
25698
25709
|
}, [
|
|
25699
25710
|
mesh,
|
|
25700
25711
|
positionOffset?.[0],
|
|
@@ -25702,7 +25713,8 @@ var JscadModel = ({
|
|
|
25702
25713
|
positionOffset?.[2],
|
|
25703
25714
|
rotationOffset?.[0],
|
|
25704
25715
|
rotationOffset?.[1],
|
|
25705
|
-
rotationOffset?.[2]
|
|
25716
|
+
rotationOffset?.[2],
|
|
25717
|
+
scale2
|
|
25706
25718
|
]);
|
|
25707
25719
|
useMemo4(() => {
|
|
25708
25720
|
if (!material) return;
|
|
@@ -25737,7 +25749,8 @@ var FootprinterModel = ({
|
|
|
25737
25749
|
rotationOffset,
|
|
25738
25750
|
onHover,
|
|
25739
25751
|
onUnhover,
|
|
25740
|
-
isHovered
|
|
25752
|
+
isHovered,
|
|
25753
|
+
scale: scale2
|
|
25741
25754
|
}) => {
|
|
25742
25755
|
const { rootObject } = useThree();
|
|
25743
25756
|
const group = useMemo5(() => {
|
|
@@ -25773,6 +25786,7 @@ var FootprinterModel = ({
|
|
|
25773
25786
|
if (!group) return;
|
|
25774
25787
|
if (positionOffset) group.position.fromArray(positionOffset);
|
|
25775
25788
|
if (rotationOffset) group.rotation.fromArray(rotationOffset);
|
|
25789
|
+
if (scale2 !== void 0) group.scale.setScalar(scale2);
|
|
25776
25790
|
}, [
|
|
25777
25791
|
group,
|
|
25778
25792
|
positionOffset?.[0],
|
|
@@ -25780,7 +25794,8 @@ var FootprinterModel = ({
|
|
|
25780
25794
|
positionOffset?.[2],
|
|
25781
25795
|
rotationOffset?.[0],
|
|
25782
25796
|
rotationOffset?.[1],
|
|
25783
|
-
rotationOffset?.[2]
|
|
25797
|
+
rotationOffset?.[2],
|
|
25798
|
+
scale2
|
|
25784
25799
|
]);
|
|
25785
25800
|
useEffect7(() => {
|
|
25786
25801
|
if (!group) return;
|
|
@@ -25892,6 +25907,7 @@ var AnyCadComponent = ({
|
|
|
25892
25907
|
cad_component2.position.z
|
|
25893
25908
|
] : void 0,
|
|
25894
25909
|
rotation: rotationOffset,
|
|
25910
|
+
scale: cad_component2.model_unit_to_mm_scale_factor,
|
|
25895
25911
|
onHover: handleHover,
|
|
25896
25912
|
onUnhover: handleUnhover,
|
|
25897
25913
|
isHovered
|
|
@@ -25909,6 +25925,7 @@ var AnyCadComponent = ({
|
|
|
25909
25925
|
cad_component2.position.z
|
|
25910
25926
|
] : void 0,
|
|
25911
25927
|
rotation: rotationOffset,
|
|
25928
|
+
scale: cad_component2.model_unit_to_mm_scale_factor,
|
|
25912
25929
|
onHover: handleHover,
|
|
25913
25930
|
onUnhover: handleUnhover,
|
|
25914
25931
|
isHovered
|
|
@@ -25921,6 +25938,7 @@ var AnyCadComponent = ({
|
|
|
25921
25938
|
{
|
|
25922
25939
|
jscadPlan: cad_component2.model_jscad,
|
|
25923
25940
|
rotationOffset,
|
|
25941
|
+
scale: cad_component2.model_unit_to_mm_scale_factor,
|
|
25924
25942
|
onHover: handleHover,
|
|
25925
25943
|
onUnhover: handleUnhover,
|
|
25926
25944
|
isHovered
|
|
@@ -25938,6 +25956,7 @@ var AnyCadComponent = ({
|
|
|
25938
25956
|
] : void 0,
|
|
25939
25957
|
rotationOffset,
|
|
25940
25958
|
footprint: cad_component2.footprinter_string,
|
|
25959
|
+
scale: cad_component2.model_unit_to_mm_scale_factor,
|
|
25941
25960
|
onHover: handleHover,
|
|
25942
25961
|
onUnhover: handleUnhover,
|
|
25943
25962
|
isHovered
|
|
@@ -25979,7 +25998,7 @@ import * as THREE11 from "three";
|
|
|
25979
25998
|
// package.json
|
|
25980
25999
|
var package_default = {
|
|
25981
26000
|
name: "@tscircuit/3d-viewer",
|
|
25982
|
-
version: "0.0.
|
|
26001
|
+
version: "0.0.374",
|
|
25983
26002
|
main: "./dist/index.js",
|
|
25984
26003
|
module: "./dist/index.js",
|
|
25985
26004
|
type: "module",
|
|
@@ -26035,7 +26054,7 @@ var package_default = {
|
|
|
26035
26054
|
"@vitejs/plugin-react": "^4.3.4",
|
|
26036
26055
|
"bun-match-svg": "^0.0.9",
|
|
26037
26056
|
"bun-types": "1.2.1",
|
|
26038
|
-
"circuit-json": "0.0.
|
|
26057
|
+
"circuit-json": "0.0.249",
|
|
26039
26058
|
"circuit-to-svg": "^0.0.179",
|
|
26040
26059
|
debug: "^4.4.0",
|
|
26041
26060
|
"jscad-electronics": "^0.0.38",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/3d-viewer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.375",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@vitejs/plugin-react": "^4.3.4",
|
|
57
57
|
"bun-match-svg": "^0.0.9",
|
|
58
58
|
"bun-types": "1.2.1",
|
|
59
|
-
"circuit-json": "0.0.
|
|
59
|
+
"circuit-json": "0.0.249",
|
|
60
60
|
"circuit-to-svg": "^0.0.179",
|
|
61
61
|
"debug": "^4.4.0",
|
|
62
62
|
"jscad-electronics": "^0.0.38",
|