@tscircuit/3d-viewer 0.0.476 → 0.0.477
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 +221 -136
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -805,13 +805,13 @@ var require_cross = __commonJS({
|
|
|
805
805
|
var require_distance = __commonJS({
|
|
806
806
|
"node_modules/@jscad/modeling/src/maths/vec3/distance.js"(exports, module) {
|
|
807
807
|
"use strict";
|
|
808
|
-
var
|
|
808
|
+
var distance3 = (a, b) => {
|
|
809
809
|
const x = b[0] - a[0];
|
|
810
810
|
const y = b[1] - a[1];
|
|
811
811
|
const z138 = b[2] - a[2];
|
|
812
812
|
return Math.sqrt(x * x + y * y + z138 * z138);
|
|
813
813
|
};
|
|
814
|
-
module.exports =
|
|
814
|
+
module.exports = distance3;
|
|
815
815
|
}
|
|
816
816
|
});
|
|
817
817
|
|
|
@@ -1933,12 +1933,12 @@ var require_cross2 = __commonJS({
|
|
|
1933
1933
|
var require_distance2 = __commonJS({
|
|
1934
1934
|
"node_modules/@jscad/modeling/src/maths/vec2/distance.js"(exports, module) {
|
|
1935
1935
|
"use strict";
|
|
1936
|
-
var
|
|
1936
|
+
var distance3 = (a, b) => {
|
|
1937
1937
|
const x = b[0] - a[0];
|
|
1938
1938
|
const y = b[1] - a[1];
|
|
1939
1939
|
return Math.sqrt(x * x + y * y);
|
|
1940
1940
|
};
|
|
1941
|
-
module.exports =
|
|
1941
|
+
module.exports = distance3;
|
|
1942
1942
|
}
|
|
1943
1943
|
});
|
|
1944
1944
|
|
|
@@ -2861,7 +2861,7 @@ var require_Vertex = __commonJS({
|
|
|
2861
2861
|
var require_HalfEdge = __commonJS({
|
|
2862
2862
|
"node_modules/@jscad/modeling/src/operations/hulls/quickhull/HalfEdge.js"(exports, module) {
|
|
2863
2863
|
"use strict";
|
|
2864
|
-
var
|
|
2864
|
+
var distance3 = require_distance();
|
|
2865
2865
|
var squaredDistance = require_squaredDistance();
|
|
2866
2866
|
var HalfEdge = class {
|
|
2867
2867
|
constructor(vertex, face) {
|
|
@@ -2879,7 +2879,7 @@ var require_HalfEdge = __commonJS({
|
|
|
2879
2879
|
}
|
|
2880
2880
|
length() {
|
|
2881
2881
|
if (this.tail()) {
|
|
2882
|
-
return
|
|
2882
|
+
return distance3(
|
|
2883
2883
|
this.tail().point,
|
|
2884
2884
|
this.head().point
|
|
2885
2885
|
);
|
|
@@ -3216,8 +3216,8 @@ var require_QuickHull = __commonJS({
|
|
|
3216
3216
|
let nextVertex;
|
|
3217
3217
|
for (let vertex = faceVertices; vertex; vertex = nextVertex) {
|
|
3218
3218
|
nextVertex = vertex.next;
|
|
3219
|
-
const
|
|
3220
|
-
if (
|
|
3219
|
+
const distance3 = absorbingFace.distanceToPlane(vertex.point);
|
|
3220
|
+
if (distance3 > this.tolerance) {
|
|
3221
3221
|
this.addVertexToFace(vertex, absorbingFace);
|
|
3222
3222
|
} else {
|
|
3223
3223
|
this.unclaimed.add(vertex);
|
|
@@ -3304,9 +3304,9 @@ var require_QuickHull = __commonJS({
|
|
|
3304
3304
|
let maxDistance = 0;
|
|
3305
3305
|
let indexMax = 0;
|
|
3306
3306
|
for (i = 0; i < 3; i += 1) {
|
|
3307
|
-
const
|
|
3308
|
-
if (
|
|
3309
|
-
maxDistance =
|
|
3307
|
+
const distance3 = max2[i].point[i] - min2[i].point[i];
|
|
3308
|
+
if (distance3 > maxDistance) {
|
|
3309
|
+
maxDistance = distance3;
|
|
3310
3310
|
indexMax = i;
|
|
3311
3311
|
}
|
|
3312
3312
|
}
|
|
@@ -3316,13 +3316,13 @@ var require_QuickHull = __commonJS({
|
|
|
3316
3316
|
for (i = 0; i < this.vertices.length; i += 1) {
|
|
3317
3317
|
const vertex = this.vertices[i];
|
|
3318
3318
|
if (vertex !== v0 && vertex !== v1) {
|
|
3319
|
-
const
|
|
3319
|
+
const distance3 = pointLineDistance(
|
|
3320
3320
|
vertex.point,
|
|
3321
3321
|
v0.point,
|
|
3322
3322
|
v1.point
|
|
3323
3323
|
);
|
|
3324
|
-
if (
|
|
3325
|
-
maxDistance =
|
|
3324
|
+
if (distance3 > maxDistance) {
|
|
3325
|
+
maxDistance = distance3;
|
|
3326
3326
|
v2 = vertex;
|
|
3327
3327
|
}
|
|
3328
3328
|
}
|
|
@@ -3333,9 +3333,9 @@ var require_QuickHull = __commonJS({
|
|
|
3333
3333
|
for (i = 0; i < this.vertices.length; i += 1) {
|
|
3334
3334
|
const vertex = this.vertices[i];
|
|
3335
3335
|
if (vertex !== v0 && vertex !== v1 && vertex !== v2) {
|
|
3336
|
-
const
|
|
3337
|
-
if (
|
|
3338
|
-
maxDistance =
|
|
3336
|
+
const distance3 = Math.abs(dot(normal, vertex.point) - distPO);
|
|
3337
|
+
if (distance3 > maxDistance) {
|
|
3338
|
+
maxDistance = distance3;
|
|
3339
3339
|
v3 = vertex;
|
|
3340
3340
|
}
|
|
3341
3341
|
}
|
|
@@ -3375,9 +3375,9 @@ var require_QuickHull = __commonJS({
|
|
|
3375
3375
|
maxDistance = this.tolerance;
|
|
3376
3376
|
let maxFace;
|
|
3377
3377
|
for (j = 0; j < 4; j += 1) {
|
|
3378
|
-
const
|
|
3379
|
-
if (
|
|
3380
|
-
maxDistance =
|
|
3378
|
+
const distance3 = faces[j].distanceToPlane(vertex.point);
|
|
3379
|
+
if (distance3 > maxDistance) {
|
|
3380
|
+
maxDistance = distance3;
|
|
3381
3381
|
maxFace = faces[j];
|
|
3382
3382
|
}
|
|
3383
3383
|
}
|
|
@@ -3433,9 +3433,9 @@ var require_QuickHull = __commonJS({
|
|
|
3433
3433
|
let maxDistance = 0;
|
|
3434
3434
|
const eyeFace = this.claimed.first().face;
|
|
3435
3435
|
for (vertex = eyeFace.outside; vertex && vertex.face === eyeFace; vertex = vertex.next) {
|
|
3436
|
-
const
|
|
3437
|
-
if (
|
|
3438
|
-
maxDistance =
|
|
3436
|
+
const distance3 = eyeFace.distanceToPlane(vertex.point);
|
|
3437
|
+
if (distance3 > maxDistance) {
|
|
3438
|
+
maxDistance = distance3;
|
|
3439
3439
|
eyeVertex = vertex;
|
|
3440
3440
|
}
|
|
3441
3441
|
}
|
|
@@ -6069,13 +6069,13 @@ var require_arcLengthToT = __commonJS({
|
|
|
6069
6069
|
distance: 0,
|
|
6070
6070
|
segments: 100
|
|
6071
6071
|
};
|
|
6072
|
-
const { distance:
|
|
6072
|
+
const { distance: distance3, segments } = Object.assign({}, defaults, options);
|
|
6073
6073
|
const arcLengths = lengths(segments, bezier);
|
|
6074
6074
|
let startIndex = 0;
|
|
6075
6075
|
let endIndex = segments;
|
|
6076
6076
|
while (startIndex <= endIndex) {
|
|
6077
6077
|
const middleIndex = Math.floor(startIndex + (endIndex - startIndex) / 2);
|
|
6078
|
-
const diff = arcLengths[middleIndex] -
|
|
6078
|
+
const diff = arcLengths[middleIndex] - distance3;
|
|
6079
6079
|
if (diff < 0) {
|
|
6080
6080
|
startIndex = middleIndex + 1;
|
|
6081
6081
|
} else if (diff > 0) {
|
|
@@ -6086,13 +6086,13 @@ var require_arcLengthToT = __commonJS({
|
|
|
6086
6086
|
}
|
|
6087
6087
|
}
|
|
6088
6088
|
const targetIndex = endIndex;
|
|
6089
|
-
if (arcLengths[targetIndex] ===
|
|
6089
|
+
if (arcLengths[targetIndex] === distance3) {
|
|
6090
6090
|
return targetIndex / segments;
|
|
6091
6091
|
}
|
|
6092
6092
|
const lengthBefore = arcLengths[targetIndex];
|
|
6093
6093
|
const lengthAfter = arcLengths[targetIndex + 1];
|
|
6094
6094
|
const segmentLength = lengthAfter - lengthBefore;
|
|
6095
|
-
const segmentFraction = (
|
|
6095
|
+
const segmentFraction = (distance3 - lengthBefore) / segmentLength;
|
|
6096
6096
|
return (targetIndex + segmentFraction) / segments;
|
|
6097
6097
|
};
|
|
6098
6098
|
module.exports = arcLengthToT;
|
|
@@ -6342,9 +6342,9 @@ var require_distanceToPoint = __commonJS({
|
|
|
6342
6342
|
"use strict";
|
|
6343
6343
|
var vec2 = require_vec2();
|
|
6344
6344
|
var distanceToPoint = (line2, point2) => {
|
|
6345
|
-
let
|
|
6346
|
-
|
|
6347
|
-
return
|
|
6345
|
+
let distance3 = vec2.dot(point2, line2);
|
|
6346
|
+
distance3 = Math.abs(distance3 - line2[2]);
|
|
6347
|
+
return distance3;
|
|
6348
6348
|
};
|
|
6349
6349
|
module.exports = distanceToPoint;
|
|
6350
6350
|
}
|
|
@@ -6368,10 +6368,10 @@ var require_fromPoints6 = __commonJS({
|
|
|
6368
6368
|
const vector = vec2.subtract(vec2.create(), point2, point1);
|
|
6369
6369
|
vec2.normal(vector, vector);
|
|
6370
6370
|
vec2.normalize(vector, vector);
|
|
6371
|
-
const
|
|
6371
|
+
const distance3 = vec2.dot(point1, vector);
|
|
6372
6372
|
out[0] = vector[0];
|
|
6373
6373
|
out[1] = vector[1];
|
|
6374
|
-
out[2] =
|
|
6374
|
+
out[2] = distance3;
|
|
6375
6375
|
return out;
|
|
6376
6376
|
};
|
|
6377
6377
|
module.exports = fromPoints;
|
|
@@ -6513,8 +6513,8 @@ var require_reverse3 = __commonJS({
|
|
|
6513
6513
|
var fromValues = require_fromValues5();
|
|
6514
6514
|
var reverse = (out, line2) => {
|
|
6515
6515
|
const normal = vec2.negate(vec2.create(), line2);
|
|
6516
|
-
const
|
|
6517
|
-
return copy(out, fromValues(normal[0], normal[1],
|
|
6516
|
+
const distance3 = -line2[2];
|
|
6517
|
+
return copy(out, fromValues(normal[0], normal[1], distance3));
|
|
6518
6518
|
};
|
|
6519
6519
|
module.exports = reverse;
|
|
6520
6520
|
}
|
|
@@ -7862,7 +7862,7 @@ var require_polyhedron = __commonJS({
|
|
|
7862
7862
|
colors: void 0,
|
|
7863
7863
|
orientation: "outward"
|
|
7864
7864
|
};
|
|
7865
|
-
const { points, faces, colors: colors2, orientation } = Object.assign({}, defaults, options);
|
|
7865
|
+
const { points, faces, colors: colors2, orientation: orientation2 } = Object.assign({}, defaults, options);
|
|
7866
7866
|
if (!(Array.isArray(points) && Array.isArray(faces))) {
|
|
7867
7867
|
throw new Error("points and faces must be arrays");
|
|
7868
7868
|
}
|
|
@@ -7887,7 +7887,7 @@ var require_polyhedron = __commonJS({
|
|
|
7887
7887
|
if (face.length < 3) throw new Error(`face ${i} must contain 3 or more indexes`);
|
|
7888
7888
|
if (!isNumberArray(face, face.length)) throw new Error(`face ${i} must be an array of numbers`);
|
|
7889
7889
|
});
|
|
7890
|
-
if (
|
|
7890
|
+
if (orientation2 !== "outward") {
|
|
7891
7891
|
faces.forEach((face) => face.reverse());
|
|
7892
7892
|
}
|
|
7893
7893
|
const polygons = faces.map((face, findex) => {
|
|
@@ -8052,7 +8052,7 @@ var require_polygon = __commonJS({
|
|
|
8052
8052
|
paths: [],
|
|
8053
8053
|
orientation: "counterclockwise"
|
|
8054
8054
|
};
|
|
8055
|
-
const { points, paths, orientation } = Object.assign({}, defaults, options);
|
|
8055
|
+
const { points, paths, orientation: orientation2 } = Object.assign({}, defaults, options);
|
|
8056
8056
|
if (!(Array.isArray(points) && Array.isArray(paths))) throw new Error("points and paths must be arrays");
|
|
8057
8057
|
let listofpolys = points;
|
|
8058
8058
|
if (Array.isArray(points[0])) {
|
|
@@ -8082,7 +8082,7 @@ var require_polygon = __commonJS({
|
|
|
8082
8082
|
sides2 = sides2.concat(geom2.toSides(geometry2));
|
|
8083
8083
|
});
|
|
8084
8084
|
let geometry = geom2.create(sides2);
|
|
8085
|
-
if (
|
|
8085
|
+
if (orientation2 === "clockwise") {
|
|
8086
8086
|
geometry = geom2.reverse(geometry);
|
|
8087
8087
|
}
|
|
8088
8088
|
return geometry;
|
|
@@ -8597,16 +8597,16 @@ var require_calculatePlane = __commonJS({
|
|
|
8597
8597
|
var calculatePlane = (slice) => {
|
|
8598
8598
|
const edges = slice.edges;
|
|
8599
8599
|
if (edges.length < 3) throw new Error("slices must have 3 or more edges to calculate a plane");
|
|
8600
|
-
const
|
|
8601
|
-
vec3.scale(
|
|
8600
|
+
const midpoint2 = edges.reduce((point2, edge) => vec3.add(vec3.create(), point2, edge[0]), vec3.create());
|
|
8601
|
+
vec3.scale(midpoint2, midpoint2, 1 / edges.length);
|
|
8602
8602
|
let farthestEdge;
|
|
8603
|
-
let
|
|
8603
|
+
let distance3 = 0;
|
|
8604
8604
|
edges.forEach((edge) => {
|
|
8605
8605
|
if (!vec3.equals(edge[0], edge[1])) {
|
|
8606
|
-
const d = vec3.squaredDistance(
|
|
8607
|
-
if (d >
|
|
8606
|
+
const d = vec3.squaredDistance(midpoint2, edge[0]);
|
|
8607
|
+
if (d > distance3) {
|
|
8608
8608
|
farthestEdge = edge;
|
|
8609
|
-
|
|
8609
|
+
distance3 = d;
|
|
8610
8610
|
}
|
|
8611
8611
|
}
|
|
8612
8612
|
});
|
|
@@ -8969,13 +8969,13 @@ var require_linkedPolygon = __commonJS({
|
|
|
8969
8969
|
const o3 = Math.sign(area(p2, q2, p1));
|
|
8970
8970
|
const o4 = Math.sign(area(p2, q2, q1));
|
|
8971
8971
|
if (o1 !== o2 && o3 !== o4) return true;
|
|
8972
|
-
if (o1 === 0 &&
|
|
8973
|
-
if (o2 === 0 &&
|
|
8974
|
-
if (o3 === 0 &&
|
|
8975
|
-
if (o4 === 0 &&
|
|
8972
|
+
if (o1 === 0 && onSegment2(p1, p2, q1)) return true;
|
|
8973
|
+
if (o2 === 0 && onSegment2(p1, q2, q1)) return true;
|
|
8974
|
+
if (o3 === 0 && onSegment2(p2, p1, q2)) return true;
|
|
8975
|
+
if (o4 === 0 && onSegment2(p2, q1, q2)) return true;
|
|
8976
8976
|
return false;
|
|
8977
8977
|
};
|
|
8978
|
-
var
|
|
8978
|
+
var onSegment2 = (p, q, r) => q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
|
|
8979
8979
|
var signedArea = (data, start, end, dim) => {
|
|
8980
8980
|
let sum = 0;
|
|
8981
8981
|
for (let i = start, j = end - dim; i < end; i += dim) {
|
|
@@ -9454,9 +9454,9 @@ var require_repair = __commonJS({
|
|
|
9454
9454
|
let bestReplacement;
|
|
9455
9455
|
missingOut.forEach((key2) => {
|
|
9456
9456
|
const v2 = vertexMap.get(key2);
|
|
9457
|
-
const
|
|
9458
|
-
if (
|
|
9459
|
-
bestDistance =
|
|
9457
|
+
const distance3 = vec3.distance(v1, v2);
|
|
9458
|
+
if (distance3 < bestDistance) {
|
|
9459
|
+
bestDistance = distance3;
|
|
9460
9460
|
bestReplacement = v2;
|
|
9461
9461
|
}
|
|
9462
9462
|
});
|
|
@@ -11802,7 +11802,7 @@ var require_offsetFromPoints = __commonJS({
|
|
|
11802
11802
|
if (Math.abs(delta) < EPS) return points;
|
|
11803
11803
|
let rotation2 = options.closed ? area(points) : 1;
|
|
11804
11804
|
if (rotation2 === 0) rotation2 = 1;
|
|
11805
|
-
const
|
|
11805
|
+
const orientation2 = rotation2 > 0 && delta >= 0 || rotation2 < 0 && delta < 0;
|
|
11806
11806
|
delta = Math.abs(delta);
|
|
11807
11807
|
let previousSegment = null;
|
|
11808
11808
|
let newPoints = [];
|
|
@@ -11813,7 +11813,7 @@ var require_offsetFromPoints = __commonJS({
|
|
|
11813
11813
|
const j = (i + 1) % n;
|
|
11814
11814
|
const p0 = points[i];
|
|
11815
11815
|
const p1 = points[j];
|
|
11816
|
-
|
|
11816
|
+
orientation2 ? vec2.subtract(of, p0, p1) : vec2.subtract(of, p1, p0);
|
|
11817
11817
|
vec2.normal(of, of);
|
|
11818
11818
|
vec2.normalize(of, of);
|
|
11819
11819
|
vec2.scale(of, of, delta);
|
|
@@ -11877,11 +11877,11 @@ var require_offsetFromPoints = __commonJS({
|
|
|
11877
11877
|
newCorners.forEach((corner) => {
|
|
11878
11878
|
let rotation3 = vec2.angle(vec2.subtract(v0, corner.s1[0], corner.c));
|
|
11879
11879
|
rotation3 -= vec2.angle(vec2.subtract(v0, corner.s0[1], corner.c));
|
|
11880
|
-
if (
|
|
11880
|
+
if (orientation2 && rotation3 < 0) {
|
|
11881
11881
|
rotation3 = rotation3 + Math.PI;
|
|
11882
11882
|
if (rotation3 < 0) rotation3 = rotation3 + Math.PI;
|
|
11883
11883
|
}
|
|
11884
|
-
if (!
|
|
11884
|
+
if (!orientation2 && rotation3 > 0) {
|
|
11885
11885
|
rotation3 = rotation3 - Math.PI;
|
|
11886
11886
|
if (rotation3 > 0) rotation3 = rotation3 - Math.PI;
|
|
11887
11887
|
}
|
|
@@ -12718,8 +12718,8 @@ var require_hullPoints2 = __commonJS({
|
|
|
12718
12718
|
const points = [];
|
|
12719
12719
|
uniquePoints.forEach((point2) => {
|
|
12720
12720
|
const angle = fakeAtan2(point2[1] - min2[1], point2[0] - min2[0]);
|
|
12721
|
-
const
|
|
12722
|
-
points.push({ point: point2, angle, distSq });
|
|
12721
|
+
const distSq2 = vec2.squaredDistance(point2, min2);
|
|
12722
|
+
points.push({ point: point2, angle, distSq: distSq2 });
|
|
12723
12723
|
});
|
|
12724
12724
|
points.sort((pt1, pt2) => pt1.angle !== pt2.angle ? pt1.angle - pt2.angle : pt1.distSq - pt2.distSq);
|
|
12725
12725
|
const stack = [];
|
|
@@ -13361,11 +13361,11 @@ var require_triangulatePolygons = __commonJS({
|
|
|
13361
13361
|
const nv = polygon3.vertices.length;
|
|
13362
13362
|
if (nv > 3) {
|
|
13363
13363
|
if (nv > 4) {
|
|
13364
|
-
const
|
|
13365
|
-
polygon3.vertices.forEach((vertice) => vec3.add(
|
|
13366
|
-
vec3.snap(
|
|
13364
|
+
const midpoint2 = [0, 0, 0];
|
|
13365
|
+
polygon3.vertices.forEach((vertice) => vec3.add(midpoint2, midpoint2, vertice));
|
|
13366
|
+
vec3.snap(midpoint2, vec3.divide(midpoint2, midpoint2, [nv, nv, nv]), epsilon);
|
|
13367
13367
|
for (let i = 0; i < nv; i++) {
|
|
13368
|
-
const poly = poly3.create([
|
|
13368
|
+
const poly = poly3.create([midpoint2, polygon3.vertices[i], polygon3.vertices[(i + 1) % nv]]);
|
|
13369
13369
|
if (polygon3.color) poly.color = polygon3.color;
|
|
13370
13370
|
triangles.push(poly);
|
|
13371
13371
|
}
|
|
@@ -18225,12 +18225,12 @@ var bga_def = z510.object({
|
|
|
18225
18225
|
});
|
|
18226
18226
|
var bga = (raw_params) => {
|
|
18227
18227
|
const parameters = bga_def.parse(raw_params);
|
|
18228
|
-
let { num_pins, grid, p, w, h: h2, ball, pad: pad2, missing } = parameters;
|
|
18228
|
+
let { num_pins, grid: grid2, p, w, h: h2, ball, pad: pad2, missing } = parameters;
|
|
18229
18229
|
ball ??= 0.75 / 1.27 * p;
|
|
18230
18230
|
pad2 ??= ball * 0.8;
|
|
18231
18231
|
const pads = [];
|
|
18232
18232
|
const missing_pin_nums = (missing ?? []).filter((a) => typeof a === "number");
|
|
18233
|
-
const num_pins_missing =
|
|
18233
|
+
const num_pins_missing = grid2.x * grid2.y - num_pins;
|
|
18234
18234
|
if (missing.length === 0 && num_pins_missing > 0) {
|
|
18235
18235
|
if (Math.sqrt(num_pins_missing) % 1 === 0) {
|
|
18236
18236
|
missing.push("center");
|
|
@@ -18240,11 +18240,11 @@ var bga = (raw_params) => {
|
|
|
18240
18240
|
}
|
|
18241
18241
|
if (missing?.includes("center")) {
|
|
18242
18242
|
const square_size = Math.floor(Math.sqrt(num_pins_missing));
|
|
18243
|
-
const inner_square_x = Math.floor((
|
|
18244
|
-
const inner_square_y = Math.floor((
|
|
18243
|
+
const inner_square_x = Math.floor((grid2.x - square_size) / 2);
|
|
18244
|
+
const inner_square_y = Math.floor((grid2.y - square_size) / 2);
|
|
18245
18245
|
for (let y = inner_square_y; y < inner_square_y + square_size; y++) {
|
|
18246
18246
|
for (let x = inner_square_x; x < inner_square_x + square_size; x++) {
|
|
18247
|
-
missing_pin_nums.push(y *
|
|
18247
|
+
missing_pin_nums.push(y * grid2.x + x + 1);
|
|
18248
18248
|
}
|
|
18249
18249
|
}
|
|
18250
18250
|
}
|
|
@@ -18253,30 +18253,30 @@ var bga = (raw_params) => {
|
|
|
18253
18253
|
}
|
|
18254
18254
|
const missing_pin_nums_set = new Set(missing_pin_nums);
|
|
18255
18255
|
let missing_pins_passed = 0;
|
|
18256
|
-
for (let y = 0; y <
|
|
18257
|
-
for (let x = 0; x <
|
|
18258
|
-
const pad_x = (x - (
|
|
18259
|
-
const pad_y = (y - (
|
|
18256
|
+
for (let y = 0; y < grid2.y; y++) {
|
|
18257
|
+
for (let x = 0; x < grid2.x; x++) {
|
|
18258
|
+
const pad_x = (x - (grid2.x - 1) / 2) * p;
|
|
18259
|
+
const pad_y = (y - (grid2.y - 1) / 2) * p;
|
|
18260
18260
|
let pin_x = x;
|
|
18261
18261
|
let pin_y = y;
|
|
18262
18262
|
switch (parameters.origin) {
|
|
18263
18263
|
case "bl":
|
|
18264
18264
|
pin_x = x;
|
|
18265
|
-
pin_y =
|
|
18265
|
+
pin_y = grid2.y - 1 - y;
|
|
18266
18266
|
break;
|
|
18267
18267
|
case "br":
|
|
18268
|
-
pin_x =
|
|
18269
|
-
pin_y =
|
|
18268
|
+
pin_x = grid2.x - 1 - x;
|
|
18269
|
+
pin_y = grid2.y - 1 - y;
|
|
18270
18270
|
break;
|
|
18271
18271
|
case "tr":
|
|
18272
|
-
pin_x =
|
|
18272
|
+
pin_x = grid2.x - 1 - x;
|
|
18273
18273
|
pin_y = y;
|
|
18274
18274
|
break;
|
|
18275
18275
|
case "tl":
|
|
18276
18276
|
default:
|
|
18277
18277
|
break;
|
|
18278
18278
|
}
|
|
18279
|
-
let pin_num = pin_y *
|
|
18279
|
+
let pin_num = pin_y * grid2.x + pin_x + 1;
|
|
18280
18280
|
if (missing_pin_nums_set.has(pin_num)) {
|
|
18281
18281
|
missing_pins_passed++;
|
|
18282
18282
|
continue;
|
|
@@ -18294,13 +18294,13 @@ var bga = (raw_params) => {
|
|
|
18294
18294
|
}
|
|
18295
18295
|
const silkscreenRefText = silkscreenRef(
|
|
18296
18296
|
0,
|
|
18297
|
-
|
|
18297
|
+
grid2.y * p / 2,
|
|
18298
18298
|
0.2
|
|
18299
18299
|
);
|
|
18300
18300
|
const pin1MarkerSize = p / 6;
|
|
18301
18301
|
let markerRoute;
|
|
18302
|
-
const edgeX =
|
|
18303
|
-
const edgeY =
|
|
18302
|
+
const edgeX = grid2.x * p / 2;
|
|
18303
|
+
const edgeY = grid2.y * p / 2;
|
|
18304
18304
|
switch (parameters.origin) {
|
|
18305
18305
|
case "bl":
|
|
18306
18306
|
markerRoute = [
|
|
@@ -18614,7 +18614,7 @@ var quad = (raw_params) => {
|
|
|
18614
18614
|
const {
|
|
18615
18615
|
x,
|
|
18616
18616
|
y,
|
|
18617
|
-
o:
|
|
18617
|
+
o: orientation2
|
|
18618
18618
|
} = getQuadCoords({
|
|
18619
18619
|
pin_count: parameters.num_pins,
|
|
18620
18620
|
pn: i + 1,
|
|
@@ -18626,7 +18626,7 @@ var quad = (raw_params) => {
|
|
|
18626
18626
|
});
|
|
18627
18627
|
let pw = parameters.pw;
|
|
18628
18628
|
let pl = parameters.pl;
|
|
18629
|
-
if (
|
|
18629
|
+
if (orientation2 === "vert") {
|
|
18630
18630
|
;
|
|
18631
18631
|
[pw, pl] = [pl, pw];
|
|
18632
18632
|
}
|
|
@@ -25622,7 +25622,7 @@ var QFN = ({
|
|
|
25622
25622
|
const {
|
|
25623
25623
|
x,
|
|
25624
25624
|
y,
|
|
25625
|
-
o:
|
|
25625
|
+
o: orientation2
|
|
25626
25626
|
} = getQuadCoords2({
|
|
25627
25627
|
pin_count: num_pins,
|
|
25628
25628
|
pn: i + 1,
|
|
@@ -25634,7 +25634,7 @@ var QFN = ({
|
|
|
25634
25634
|
});
|
|
25635
25635
|
let pw = padWidth;
|
|
25636
25636
|
let pl = padLength;
|
|
25637
|
-
if (
|
|
25637
|
+
if (orientation2 === "vert") {
|
|
25638
25638
|
;
|
|
25639
25639
|
[pw, pl] = [pl, pw];
|
|
25640
25640
|
}
|
|
@@ -29492,7 +29492,7 @@ import * as THREE15 from "three";
|
|
|
29492
29492
|
// package.json
|
|
29493
29493
|
var package_default = {
|
|
29494
29494
|
name: "@tscircuit/3d-viewer",
|
|
29495
|
-
version: "0.0.
|
|
29495
|
+
version: "0.0.476",
|
|
29496
29496
|
main: "./dist/index.js",
|
|
29497
29497
|
module: "./dist/index.js",
|
|
29498
29498
|
type: "module",
|
|
@@ -29652,12 +29652,12 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
29652
29652
|
);
|
|
29653
29653
|
const baseDistance = useMemo8(() => {
|
|
29654
29654
|
const [x, y, z138] = initialCameraPosition ?? [5, -5, 5];
|
|
29655
|
-
const
|
|
29655
|
+
const distance3 = Math.hypot(
|
|
29656
29656
|
x - defaultTarget.x,
|
|
29657
29657
|
y - defaultTarget.y,
|
|
29658
29658
|
z138 - defaultTarget.z
|
|
29659
29659
|
);
|
|
29660
|
-
return
|
|
29660
|
+
return distance3 > 0 ? distance3 : 5;
|
|
29661
29661
|
}, [initialCameraPosition, defaultTarget]);
|
|
29662
29662
|
const getPresetConfig = useCallback4(
|
|
29663
29663
|
(preset) => {
|
|
@@ -29668,13 +29668,13 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
29668
29668
|
];
|
|
29669
29669
|
const camera = mainCameraRef.current;
|
|
29670
29670
|
const controls = controlsRef.current;
|
|
29671
|
-
let
|
|
29671
|
+
let distance3 = baseDistance;
|
|
29672
29672
|
if (camera && controls) {
|
|
29673
|
-
|
|
29673
|
+
distance3 = camera.position.distanceTo(controls.target);
|
|
29674
29674
|
}
|
|
29675
29675
|
switch (preset) {
|
|
29676
29676
|
case "Top Center Angled": {
|
|
29677
|
-
const angledOffset =
|
|
29677
|
+
const angledOffset = distance3 / Math.sqrt(2);
|
|
29678
29678
|
return {
|
|
29679
29679
|
position: [
|
|
29680
29680
|
defaultTarget.x,
|
|
@@ -29690,7 +29690,7 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
29690
29690
|
position: [
|
|
29691
29691
|
defaultTarget.x,
|
|
29692
29692
|
defaultTarget.y,
|
|
29693
|
-
defaultTarget.z +
|
|
29693
|
+
defaultTarget.z + distance3
|
|
29694
29694
|
],
|
|
29695
29695
|
target: targetVector,
|
|
29696
29696
|
up: [0, 0, 1]
|
|
@@ -29698,9 +29698,9 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
29698
29698
|
case "Top Left Corner":
|
|
29699
29699
|
return {
|
|
29700
29700
|
position: [
|
|
29701
|
-
defaultTarget.x -
|
|
29702
|
-
defaultTarget.y -
|
|
29703
|
-
defaultTarget.z +
|
|
29701
|
+
defaultTarget.x - distance3 * 0.6,
|
|
29702
|
+
defaultTarget.y - distance3 * 0.6,
|
|
29703
|
+
defaultTarget.z + distance3 * 0.6
|
|
29704
29704
|
],
|
|
29705
29705
|
target: targetVector,
|
|
29706
29706
|
up: [0, 0, 1]
|
|
@@ -29708,9 +29708,9 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
29708
29708
|
case "Top Right Corner":
|
|
29709
29709
|
return {
|
|
29710
29710
|
position: [
|
|
29711
|
-
defaultTarget.x +
|
|
29712
|
-
defaultTarget.y -
|
|
29713
|
-
defaultTarget.z +
|
|
29711
|
+
defaultTarget.x + distance3 * 0.6,
|
|
29712
|
+
defaultTarget.y - distance3 * 0.6,
|
|
29713
|
+
defaultTarget.z + distance3 * 0.6
|
|
29714
29714
|
],
|
|
29715
29715
|
target: targetVector,
|
|
29716
29716
|
up: [0, 0, 1]
|
|
@@ -29718,7 +29718,7 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
29718
29718
|
case "Left Sideview":
|
|
29719
29719
|
return {
|
|
29720
29720
|
position: [
|
|
29721
|
-
defaultTarget.x -
|
|
29721
|
+
defaultTarget.x - distance3,
|
|
29722
29722
|
defaultTarget.y,
|
|
29723
29723
|
defaultTarget.z
|
|
29724
29724
|
],
|
|
@@ -29728,7 +29728,7 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
29728
29728
|
case "Right Sideview":
|
|
29729
29729
|
return {
|
|
29730
29730
|
position: [
|
|
29731
|
-
defaultTarget.x +
|
|
29731
|
+
defaultTarget.x + distance3,
|
|
29732
29732
|
defaultTarget.y,
|
|
29733
29733
|
defaultTarget.z
|
|
29734
29734
|
],
|
|
@@ -29739,7 +29739,7 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
29739
29739
|
return {
|
|
29740
29740
|
position: [
|
|
29741
29741
|
defaultTarget.x,
|
|
29742
|
-
defaultTarget.y -
|
|
29742
|
+
defaultTarget.y - distance3,
|
|
29743
29743
|
defaultTarget.z
|
|
29744
29744
|
],
|
|
29745
29745
|
target: targetVector,
|
|
@@ -30321,13 +30321,13 @@ import { useEffect as useEffect15, useRef as useRef7 } from "react";
|
|
|
30321
30321
|
import * as THREE14 from "three";
|
|
30322
30322
|
import { Text as TroikaText } from "troika-three-text";
|
|
30323
30323
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
30324
|
-
function computePointInFront(rotationVector,
|
|
30324
|
+
function computePointInFront(rotationVector, distance3) {
|
|
30325
30325
|
const quaternion = new THREE14.Quaternion().setFromEuler(
|
|
30326
30326
|
new THREE14.Euler(rotationVector.x, rotationVector.y, rotationVector.z)
|
|
30327
30327
|
);
|
|
30328
30328
|
const forwardVector = new THREE14.Vector3(0, 0, 1);
|
|
30329
30329
|
forwardVector.applyQuaternion(quaternion);
|
|
30330
|
-
const result = forwardVector.multiplyScalar(
|
|
30330
|
+
const result = forwardVector.multiplyScalar(distance3);
|
|
30331
30331
|
return result;
|
|
30332
30332
|
}
|
|
30333
30333
|
var OrientationCubeCanvas = () => {
|
|
@@ -32607,6 +32607,58 @@ import { su as su9 } from "@tscircuit/circuit-json-util";
|
|
|
32607
32607
|
// src/utils/soldermask-texture.ts
|
|
32608
32608
|
import * as THREE18 from "three";
|
|
32609
32609
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
32610
|
+
|
|
32611
|
+
// node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
|
|
32612
|
+
var getBoundsFromPoints = (points) => {
|
|
32613
|
+
if (points.length === 0) {
|
|
32614
|
+
return null;
|
|
32615
|
+
}
|
|
32616
|
+
let minX = points[0].x;
|
|
32617
|
+
let minY = points[0].y;
|
|
32618
|
+
let maxX = points[0].x;
|
|
32619
|
+
let maxY = points[0].y;
|
|
32620
|
+
for (let i = 1; i < points.length; i++) {
|
|
32621
|
+
const point2 = points[i];
|
|
32622
|
+
if (point2.x < minX) minX = point2.x;
|
|
32623
|
+
if (point2.y < minY) minY = point2.y;
|
|
32624
|
+
if (point2.x > maxX) maxX = point2.x;
|
|
32625
|
+
if (point2.y > maxY) maxY = point2.y;
|
|
32626
|
+
}
|
|
32627
|
+
return { minX, minY, maxX, maxY };
|
|
32628
|
+
};
|
|
32629
|
+
|
|
32630
|
+
// src/utils/outline-bounds.ts
|
|
32631
|
+
function calculateOutlineBounds(boardData) {
|
|
32632
|
+
if (boardData.outline && boardData.outline.length >= 3) {
|
|
32633
|
+
const bounds2 = getBoundsFromPoints(boardData.outline);
|
|
32634
|
+
return {
|
|
32635
|
+
...bounds2,
|
|
32636
|
+
width: bounds2.maxX - bounds2.minX,
|
|
32637
|
+
height: bounds2.maxY - bounds2.minY,
|
|
32638
|
+
centerX: (bounds2.minX + bounds2.maxX) / 2,
|
|
32639
|
+
centerY: (bounds2.minY + bounds2.maxY) / 2
|
|
32640
|
+
};
|
|
32641
|
+
}
|
|
32642
|
+
const boardWidth = boardData.width ?? 0;
|
|
32643
|
+
const boardHeight = boardData.height ?? 0;
|
|
32644
|
+
const boardCenterX = boardData.center?.x ?? 0;
|
|
32645
|
+
const boardCenterY = boardData.center?.y ?? 0;
|
|
32646
|
+
const bounds = {
|
|
32647
|
+
minX: boardCenterX - boardWidth / 2,
|
|
32648
|
+
maxX: boardCenterX + boardWidth / 2,
|
|
32649
|
+
minY: boardCenterY - boardHeight / 2,
|
|
32650
|
+
maxY: boardCenterY + boardHeight / 2
|
|
32651
|
+
};
|
|
32652
|
+
return {
|
|
32653
|
+
...bounds,
|
|
32654
|
+
width: boardWidth,
|
|
32655
|
+
height: boardHeight,
|
|
32656
|
+
centerX: boardCenterX,
|
|
32657
|
+
centerY: boardCenterY
|
|
32658
|
+
};
|
|
32659
|
+
}
|
|
32660
|
+
|
|
32661
|
+
// src/utils/soldermask-texture.ts
|
|
32610
32662
|
function createSoldermaskTextureForLayer({
|
|
32611
32663
|
layer,
|
|
32612
32664
|
circuitJson,
|
|
@@ -32614,9 +32666,14 @@ function createSoldermaskTextureForLayer({
|
|
|
32614
32666
|
soldermaskColor,
|
|
32615
32667
|
traceTextureResolution
|
|
32616
32668
|
}) {
|
|
32669
|
+
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
32617
32670
|
const canvas = document.createElement("canvas");
|
|
32618
|
-
const canvasWidth = Math.floor(
|
|
32619
|
-
|
|
32671
|
+
const canvasWidth = Math.floor(
|
|
32672
|
+
boardOutlineBounds.width * traceTextureResolution
|
|
32673
|
+
);
|
|
32674
|
+
const canvasHeight = Math.floor(
|
|
32675
|
+
boardOutlineBounds.height * traceTextureResolution
|
|
32676
|
+
);
|
|
32620
32677
|
canvas.width = canvasWidth;
|
|
32621
32678
|
canvas.height = canvasHeight;
|
|
32622
32679
|
const ctx = canvas.getContext("2d");
|
|
@@ -32625,8 +32682,8 @@ function createSoldermaskTextureForLayer({
|
|
|
32625
32682
|
ctx.translate(0, canvasHeight);
|
|
32626
32683
|
ctx.scale(1, -1);
|
|
32627
32684
|
}
|
|
32628
|
-
const canvasXFromPcb = (pcbX) => (pcbX -
|
|
32629
|
-
const canvasYFromPcb = (pcbY) => (
|
|
32685
|
+
const canvasXFromPcb = (pcbX) => (pcbX - boardOutlineBounds.minX) * traceTextureResolution;
|
|
32686
|
+
const canvasYFromPcb = (pcbY) => (boardOutlineBounds.maxY - pcbY) * traceTextureResolution;
|
|
32630
32687
|
ctx.fillStyle = soldermaskColor;
|
|
32631
32688
|
if (boardData.outline && boardData.outline.length >= 3) {
|
|
32632
32689
|
ctx.beginPath();
|
|
@@ -33409,9 +33466,14 @@ function createSilkscreenTextureForLayer({
|
|
|
33409
33466
|
if (textsOnLayer.length === 0 && pathsOnLayer.length === 0 && linesOnLayer.length === 0 && rectsOnLayer.length === 0 && circlesOnLayer.length === 0 && fabricationNoteRectsOnLayer.length === 0 && noteLinesOnLayer.length === 0) {
|
|
33410
33467
|
return null;
|
|
33411
33468
|
}
|
|
33469
|
+
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
33412
33470
|
const canvas = document.createElement("canvas");
|
|
33413
|
-
const canvasWidth = Math.floor(
|
|
33414
|
-
|
|
33471
|
+
const canvasWidth = Math.floor(
|
|
33472
|
+
boardOutlineBounds.width * traceTextureResolution
|
|
33473
|
+
);
|
|
33474
|
+
const canvasHeight = Math.floor(
|
|
33475
|
+
boardOutlineBounds.height * traceTextureResolution
|
|
33476
|
+
);
|
|
33415
33477
|
canvas.width = canvasWidth;
|
|
33416
33478
|
canvas.height = canvasHeight;
|
|
33417
33479
|
const ctx = canvas.getContext("2d");
|
|
@@ -33422,8 +33484,8 @@ function createSilkscreenTextureForLayer({
|
|
|
33422
33484
|
}
|
|
33423
33485
|
ctx.strokeStyle = silkscreenColor;
|
|
33424
33486
|
ctx.fillStyle = silkscreenColor;
|
|
33425
|
-
const canvasXFromPcb = (pcbX) => (pcbX -
|
|
33426
|
-
const canvasYFromPcb = (pcbY) => (
|
|
33487
|
+
const canvasXFromPcb = (pcbX) => (pcbX - boardOutlineBounds.minX) * traceTextureResolution;
|
|
33488
|
+
const canvasYFromPcb = (pcbY) => (boardOutlineBounds.maxY - pcbY) * traceTextureResolution;
|
|
33427
33489
|
linesOnLayer.forEach((lineEl) => {
|
|
33428
33490
|
const startXmm = parseDimensionToMm(lineEl.x1) ?? 0;
|
|
33429
33491
|
const startYmm = parseDimensionToMm(lineEl.y1) ?? 0;
|
|
@@ -33789,9 +33851,14 @@ function createTraceTextureForLayer({
|
|
|
33789
33851
|
(t) => t.route.some((p) => isWireRoutePoint(p) && p.layer === layer)
|
|
33790
33852
|
);
|
|
33791
33853
|
if (tracesOnLayer.length === 0) return null;
|
|
33854
|
+
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
33792
33855
|
const canvas = document.createElement("canvas");
|
|
33793
|
-
const canvasWidth = Math.floor(
|
|
33794
|
-
|
|
33856
|
+
const canvasWidth = Math.floor(
|
|
33857
|
+
boardOutlineBounds.width * traceTextureResolution
|
|
33858
|
+
);
|
|
33859
|
+
const canvasHeight = Math.floor(
|
|
33860
|
+
boardOutlineBounds.height * traceTextureResolution
|
|
33861
|
+
);
|
|
33795
33862
|
canvas.width = canvasWidth;
|
|
33796
33863
|
canvas.height = canvasHeight;
|
|
33797
33864
|
const ctx = canvas.getContext("2d");
|
|
@@ -33817,8 +33884,8 @@ function createTraceTextureForLayer({
|
|
|
33817
33884
|
const pcbY = point2.y;
|
|
33818
33885
|
currentLineWidth = point2.width * traceTextureResolution;
|
|
33819
33886
|
ctx.lineWidth = currentLineWidth;
|
|
33820
|
-
const canvasX = (pcbX -
|
|
33821
|
-
const canvasY = (
|
|
33887
|
+
const canvasX = (pcbX - boardOutlineBounds.minX) * traceTextureResolution;
|
|
33888
|
+
const canvasY = (boardOutlineBounds.maxY - pcbY) * traceTextureResolution;
|
|
33822
33889
|
if (firstPoint) {
|
|
33823
33890
|
ctx.moveTo(canvasX, canvasY);
|
|
33824
33891
|
firstPoint = false;
|
|
@@ -33833,8 +33900,8 @@ function createTraceTextureForLayer({
|
|
|
33833
33900
|
ctx.globalCompositeOperation = "destination-out";
|
|
33834
33901
|
ctx.fillStyle = "black";
|
|
33835
33902
|
allPcbVias.forEach((via) => {
|
|
33836
|
-
const canvasX = (via.x -
|
|
33837
|
-
const canvasY = (
|
|
33903
|
+
const canvasX = (via.x - boardOutlineBounds.minX) * traceTextureResolution;
|
|
33904
|
+
const canvasY = (boardOutlineBounds.maxY - via.y) * traceTextureResolution;
|
|
33838
33905
|
const canvasRadius = via.outer_diameter / 2 * traceTextureResolution;
|
|
33839
33906
|
ctx.beginPath();
|
|
33840
33907
|
ctx.arc(canvasX, canvasY, canvasRadius, 0, 2 * Math.PI, false);
|
|
@@ -33842,8 +33909,8 @@ function createTraceTextureForLayer({
|
|
|
33842
33909
|
});
|
|
33843
33910
|
allPcbPlatedHoles.forEach((ph) => {
|
|
33844
33911
|
if (ph.layers.includes(layer) && ph.shape === "circle") {
|
|
33845
|
-
const canvasX = (ph.x -
|
|
33846
|
-
const canvasY = (
|
|
33912
|
+
const canvasX = (ph.x - boardOutlineBounds.minX) * traceTextureResolution;
|
|
33913
|
+
const canvasY = (boardOutlineBounds.maxY - ph.y) * traceTextureResolution;
|
|
33847
33914
|
const canvasRadius = ph.outer_diameter / 2 * traceTextureResolution;
|
|
33848
33915
|
ctx.beginPath();
|
|
33849
33916
|
ctx.arc(canvasX, canvasY, canvasRadius, 0, 2 * Math.PI, false);
|
|
@@ -34038,9 +34105,14 @@ function createCopperTextTextureForLayer({
|
|
|
34038
34105
|
if (textsOnLayer.length === 0) {
|
|
34039
34106
|
return null;
|
|
34040
34107
|
}
|
|
34108
|
+
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
34041
34109
|
const canvas = document.createElement("canvas");
|
|
34042
|
-
const canvasWidth = Math.floor(
|
|
34043
|
-
|
|
34110
|
+
const canvasWidth = Math.floor(
|
|
34111
|
+
boardOutlineBounds.width * traceTextureResolution
|
|
34112
|
+
);
|
|
34113
|
+
const canvasHeight = Math.floor(
|
|
34114
|
+
boardOutlineBounds.height * traceTextureResolution
|
|
34115
|
+
);
|
|
34044
34116
|
canvas.width = canvasWidth;
|
|
34045
34117
|
canvas.height = canvasHeight;
|
|
34046
34118
|
const ctx = canvas.getContext("2d");
|
|
@@ -34051,8 +34123,8 @@ function createCopperTextTextureForLayer({
|
|
|
34051
34123
|
}
|
|
34052
34124
|
ctx.strokeStyle = copperColor;
|
|
34053
34125
|
ctx.fillStyle = copperColor;
|
|
34054
|
-
const canvasXFromPcb = (pcbX) => (pcbX -
|
|
34055
|
-
const canvasYFromPcb = (pcbY) => (
|
|
34126
|
+
const canvasXFromPcb = (pcbX) => (pcbX - boardOutlineBounds.minX) * traceTextureResolution;
|
|
34127
|
+
const canvasYFromPcb = (pcbY) => (boardOutlineBounds.maxY - pcbY) * traceTextureResolution;
|
|
34056
34128
|
textsOnLayer.forEach((textS) => {
|
|
34057
34129
|
const fontSize = typeof textS.font_size === "number" ? textS.font_size : 0.2;
|
|
34058
34130
|
const textStrokeWidth = Math.max(0.02, fontSize * 0.08) * traceTextureResolution;
|
|
@@ -34287,9 +34359,10 @@ function JscadBoardTextures({
|
|
|
34287
34359
|
const meshes = [];
|
|
34288
34360
|
const createTexturePlane = (texture, zOffset, isBottomLayer, name, usePolygonOffset = false, depthWrite = false) => {
|
|
34289
34361
|
if (!texture) return null;
|
|
34362
|
+
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
34290
34363
|
const planeGeom = new THREE23.PlaneGeometry(
|
|
34291
|
-
|
|
34292
|
-
|
|
34364
|
+
boardOutlineBounds.width,
|
|
34365
|
+
boardOutlineBounds.height
|
|
34293
34366
|
);
|
|
34294
34367
|
const material = new THREE23.MeshBasicMaterial({
|
|
34295
34368
|
map: texture,
|
|
@@ -34301,7 +34374,11 @@ function JscadBoardTextures({
|
|
|
34301
34374
|
polygonOffsetUnits: usePolygonOffset ? -1 : 0
|
|
34302
34375
|
});
|
|
34303
34376
|
const mesh = new THREE23.Mesh(planeGeom, material);
|
|
34304
|
-
mesh.position.set(
|
|
34377
|
+
mesh.position.set(
|
|
34378
|
+
boardOutlineBounds.centerX,
|
|
34379
|
+
boardOutlineBounds.centerY,
|
|
34380
|
+
zOffset
|
|
34381
|
+
);
|
|
34305
34382
|
if (isBottomLayer) {
|
|
34306
34383
|
mesh.rotation.set(Math.PI, 0, 0);
|
|
34307
34384
|
}
|
|
@@ -36393,7 +36470,11 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
36393
36470
|
if (!textures || !boardData || pcbThickness === null) return meshes;
|
|
36394
36471
|
const createTexturePlane = (texture, yOffset, isBottomLayer, keySuffix, usePolygonOffset = false, renderOrder = 0) => {
|
|
36395
36472
|
if (!texture) return null;
|
|
36396
|
-
const
|
|
36473
|
+
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
36474
|
+
const planeGeom = new THREE32.PlaneGeometry(
|
|
36475
|
+
boardOutlineBounds.width,
|
|
36476
|
+
boardOutlineBounds.height
|
|
36477
|
+
);
|
|
36397
36478
|
const material = new THREE32.MeshBasicMaterial({
|
|
36398
36479
|
map: texture,
|
|
36399
36480
|
transparent: true,
|
|
@@ -36405,7 +36486,11 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
36405
36486
|
polygonOffsetUnits: usePolygonOffset ? -4 : 0
|
|
36406
36487
|
});
|
|
36407
36488
|
const mesh = new THREE32.Mesh(planeGeom, material);
|
|
36408
|
-
mesh.position.set(
|
|
36489
|
+
mesh.position.set(
|
|
36490
|
+
boardOutlineBounds.centerX,
|
|
36491
|
+
boardOutlineBounds.centerY,
|
|
36492
|
+
yOffset
|
|
36493
|
+
);
|
|
36409
36494
|
if (isBottomLayer) {
|
|
36410
36495
|
mesh.rotation.set(Math.PI, 0, 0);
|
|
36411
36496
|
}
|
|
@@ -38108,7 +38193,7 @@ var oppositeAlignmentMap = {
|
|
|
38108
38193
|
start: "end",
|
|
38109
38194
|
end: "start"
|
|
38110
38195
|
};
|
|
38111
|
-
function
|
|
38196
|
+
function clamp2(start, value, end) {
|
|
38112
38197
|
return max(start, min(value, end));
|
|
38113
38198
|
}
|
|
38114
38199
|
function evaluate(value, param) {
|
|
@@ -38461,7 +38546,7 @@ var arrow = (options) => ({
|
|
|
38461
38546
|
const min$1 = minPadding;
|
|
38462
38547
|
const max2 = clientSize - arrowDimensions[length2] - maxPadding;
|
|
38463
38548
|
const center = clientSize / 2 - arrowDimensions[length2] / 2 + centerToReference;
|
|
38464
|
-
const offset4 =
|
|
38549
|
+
const offset4 = clamp2(min$1, center, max2);
|
|
38465
38550
|
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length2] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length2] / 2 < 0;
|
|
38466
38551
|
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
38467
38552
|
return {
|
|
@@ -38758,14 +38843,14 @@ var shift = function(options) {
|
|
|
38758
38843
|
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
38759
38844
|
const min2 = mainAxisCoord + overflow[minSide];
|
|
38760
38845
|
const max2 = mainAxisCoord - overflow[maxSide];
|
|
38761
|
-
mainAxisCoord =
|
|
38846
|
+
mainAxisCoord = clamp2(min2, mainAxisCoord, max2);
|
|
38762
38847
|
}
|
|
38763
38848
|
if (checkCrossAxis) {
|
|
38764
38849
|
const minSide = crossAxis === "y" ? "top" : "left";
|
|
38765
38850
|
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
38766
38851
|
const min2 = crossAxisCoord + overflow[minSide];
|
|
38767
38852
|
const max2 = crossAxisCoord - overflow[maxSide];
|
|
38768
|
-
crossAxisCoord =
|
|
38853
|
+
crossAxisCoord = clamp2(min2, crossAxisCoord, max2);
|
|
38769
38854
|
}
|
|
38770
38855
|
const limitedCoords = limiter.fn({
|
|
38771
38856
|
...state,
|
|
@@ -40470,7 +40555,7 @@ RovingFocusGroup.displayName = GROUP_NAME;
|
|
|
40470
40555
|
var RovingFocusGroupImpl = React34.forwardRef((props, forwardedRef) => {
|
|
40471
40556
|
const {
|
|
40472
40557
|
__scopeRovingFocusGroup,
|
|
40473
|
-
orientation,
|
|
40558
|
+
orientation: orientation2,
|
|
40474
40559
|
loop = false,
|
|
40475
40560
|
dir,
|
|
40476
40561
|
currentTabStopId: currentTabStopIdProp,
|
|
@@ -40505,7 +40590,7 @@ var RovingFocusGroupImpl = React34.forwardRef((props, forwardedRef) => {
|
|
|
40505
40590
|
RovingFocusProvider,
|
|
40506
40591
|
{
|
|
40507
40592
|
scope: __scopeRovingFocusGroup,
|
|
40508
|
-
orientation,
|
|
40593
|
+
orientation: orientation2,
|
|
40509
40594
|
dir: direction,
|
|
40510
40595
|
loop,
|
|
40511
40596
|
currentTabStopId,
|
|
@@ -40526,7 +40611,7 @@ var RovingFocusGroupImpl = React34.forwardRef((props, forwardedRef) => {
|
|
|
40526
40611
|
Primitive.div,
|
|
40527
40612
|
{
|
|
40528
40613
|
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
40529
|
-
"data-orientation":
|
|
40614
|
+
"data-orientation": orientation2,
|
|
40530
40615
|
...groupProps,
|
|
40531
40616
|
ref: composedRefs,
|
|
40532
40617
|
style: { outline: "none", ...props.style },
|
|
@@ -40642,10 +40727,10 @@ function getDirectionAwareKey(key, dir) {
|
|
|
40642
40727
|
if (dir !== "rtl") return key;
|
|
40643
40728
|
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
40644
40729
|
}
|
|
40645
|
-
function getFocusIntent(event,
|
|
40730
|
+
function getFocusIntent(event, orientation2, dir) {
|
|
40646
40731
|
const key = getDirectionAwareKey(event.key, dir);
|
|
40647
|
-
if (
|
|
40648
|
-
if (
|
|
40732
|
+
if (orientation2 === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
40733
|
+
if (orientation2 === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
40649
40734
|
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
40650
40735
|
}
|
|
40651
40736
|
function focusFirst2(candidates, preventScroll = false) {
|