Skip to content

How to take svg transformations into account when creating an element? #2506

Closed Answered by kumilingus
Komar0ff asked this question in Q&A
Discussion options

You must be logged in to vote

It seems like the connectors and nodes require different logic (not sure how you converted them in the first place).

You can also start without reverting the y coordinate.
It looks to me that the SVG is flipped with matrix(1, 0, 0, -1, 0, 0) but it must be also translated with matrix(1, 0, 0, -1, 0, -HEIGHT)
Tried this method, but unfortunately it also did not solve my problem( Any other ideas?

It actually quite worked for me.

const generateComplexCell = (element, parentMatrix) => {
    const GET_BOX = element.getBBox()

    const componentMatrix = element.transform.baseVal.consolidate().matrix
    let sanitizeElement = null
    let mutateMatrix = null

    if (parentMatrix && component…

Replies: 2 comments 20 replies

Comment options

You must be logged in to vote
1 reply
@kumilingus
Comment options

Comment options

You must be logged in to vote
19 replies
@kumilingus
Comment options

@Komar0ff
Comment options

@Komar0ff
Comment options

@kumilingus
Comment options

Answer selected by Komar0ff
@Komar0ff
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants