1
0
Fork 0

Merge pull request #4849 from compilin/develop

fix(core): fixed buggy bounds computation in cutting and printing layout when parts are rotated & fix(dev): fixed invalid PageLink imports
This commit is contained in:
Joost De Cock 2023-08-29 10:03:30 +02:00 committed by GitHub
commit c11a0e1df6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 35 deletions

View file

@ -803,7 +803,7 @@ function matrixTransform(transformationType, matrix, values) {
const centerY = values[2] const centerY = values[2]
// if there's a rotation center, we need to move the origin to that center // if there's a rotation center, we need to move the origin to that center
if (centerX) { if (centerX !== undefined) {
matrix = matrixTransform('translate', matrix, [centerX, centerY]) matrix = matrixTransform('translate', matrix, [centerX, centerY])
} }
@ -820,7 +820,7 @@ function matrixTransform(transformationType, matrix, values) {
] ]
// move the origin back to origin // move the origin back to origin
if (centerX) { if (centerX !== undefined) {
matrix = matrixTransform('translate', matrix, [-centerX, -centerY]) matrix = matrixTransform('translate', matrix, [-centerX, -centerY])
} }
break break
@ -875,35 +875,7 @@ export function applyTransformToPoint(transform, point) {
// The starting matrix // The starting matrix
let matrix = [1, 0, 0, 1, 0, 0] let matrix = [1, 0, 0, 1, 0, 0]
matrix = matrixTransform(name, matrix, values)
// Update matrix for transform
switch (name) {
case 'matrix':
matrix = values
break
case 'translate':
matrix[4] = values[0]
matrix[5] = values[1]
break
case 'scale':
matrix[0] = values[0]
matrix[3] = values[1]
break
case 'rotate': {
const angle = (values[0] * Math.PI) / 180
const cos = Math.cos(angle)
const sin = Math.sin(angle)
console.log('in rotate', { angle })
matrix = [cos, sin, -sin, cos, 0, 0]
break
}
case 'skewX':
matrix[2] = Math.tan((values[0] * Math.PI) / 180)
break
case 'skewY':
matrix[1] = Math.tan((values[0] * Math.PI) / 180)
break
}
// Apply the matrix transform to the coordinates // Apply the matrix transform to the coordinates
const newX = point.x * matrix[0] + point.y * matrix[2] + matrix[4] const newX = point.x * matrix[0] + point.y * matrix[2] + matrix[4]

View file

@ -112,7 +112,7 @@ playwright-report
'shared/components/lightbox.mjs', 'shared/components/lightbox.mjs',
'shared/components/loader.mjs', 'shared/components/loader.mjs',
'shared/components/modal.mjs', 'shared/components/modal.mjs',
'shared/components/page-link.mjs', 'shared/components/link.mjs',
'shared/components/picker.mjs', 'shared/components/picker.mjs',
'shared/components/popout.mjs', 'shared/components/popout.mjs',
'shared/components/raw-span.mjs', 'shared/components/raw-span.mjs',

View file

@ -5,7 +5,7 @@ import Head from 'next/head'
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs' import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
import { Robot } from 'shared/components/robot/index.mjs' import { Robot } from 'shared/components/robot/index.mjs'
import { Popout } from 'shared/components/popout/index.mjs' import { Popout } from 'shared/components/popout/index.mjs'
import { PageLink } from 'shared/components/page-link.mjs' import { PageLink } from 'shared/components/link.mjs'
import { BaseLayout, BaseLayoutLeft, BaseLayoutWide } from 'shared/components/base-layout.mjs' import { BaseLayout, BaseLayoutLeft, BaseLayoutWide } from 'shared/components/base-layout.mjs'
import { NavLinks, MainSections } from 'shared/components/navigation/sitenav.mjs' import { NavLinks, MainSections } from 'shared/components/navigation/sitenav.mjs'

View file

@ -3,7 +3,7 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
// Components // Components
import Head from 'next/head' import Head from 'next/head'
import { PageWrapper } from 'shared/components/wrappers/page.mjs' import { PageWrapper } from 'shared/components/wrappers/page.mjs'
import { PageLink } from 'shared/components/page-link.mjs' import { PageLink } from 'shared/components/link.mjs'
import { Highlight } from 'shared/components/mdx/highlight.mjs' import { Highlight } from 'shared/components/mdx/highlight.mjs'
import { FreeSewingIcon } from 'shared/components/icons.mjs' import { FreeSewingIcon } from 'shared/components/icons.mjs'
import Link from 'next/link' import Link from 'next/link'

View file

@ -4,7 +4,7 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs' import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
import { Search } from 'site/components/search.mjs' import { Search } from 'site/components/search.mjs'
import { Popout } from 'shared/components/popout/index.mjs' import { Popout } from 'shared/components/popout/index.mjs'
import { PageLink } from 'shared/components/page-link.mjs' import { PageLink } from 'shared/components/link.mjs'
import { NavLinks, Breadcrumbs, MainSections } from 'shared/components/navigation/sitenav.mjs' import { NavLinks, Breadcrumbs, MainSections } from 'shared/components/navigation/sitenav.mjs'
import { import {
BaseLayout, BaseLayout,