Skip to content

Commit

Permalink
svg-new-center3
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinatzo committed Sep 3, 2024
1 parent 22fc0d6 commit 4c9dbd5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/abstract-3d/src/renderers/svg/svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export function toSvg(
const height = sizeScaled.y + 1.5 * stroke;
const elements = Array<zOrderElement>();
const point = (x: number, y: number): A3D.Vec2 =>
A3D.vec2((size.x * 0.5 + x) * factor - stroke * 0.75, (size.y * 0.5 - y) * factor + stroke * 0.75);
A3D.vec2(
(-center.x + size.x * 0.5 + x) * factor - stroke * 0.75,
(center.y + size.y * 0.5 - y) * factor + stroke * 0.75
);
for (const g of scene.groups) {
elements.push(
...svgGroup(g, center, unitRot, point, view, factor, onlyStroke, grayScale, onlyStrokeFill, font, stroke, buffers)
Expand All @@ -55,7 +58,7 @@ export function toSvg(
const cameraPos = A3D.vec3Rot(A3D.vec3(1, 1, 1), A3D.vec3Zero, scene.rotation_deprecated ?? A3D.vec3Zero);
for (const d of scene.dimensions_deprecated?.dimensions ?? []) {
if (flipViews(d.views[0], cameraPos) === view) {
const pos = A3D.vec3Rot(d.pos, unitPos, unitRot);
const pos = A3D.vec3TransRot(d.pos, center, unitRot);
const rot = A3D.vec3RotCombine(unitRot, d.rot);
for (const m of d.meshes) {
elements.push(
Expand Down

0 comments on commit 4c9dbd5

Please sign in to comment.