Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(dev) Strange things on opened SVGs #14

Open
linuslabo opened this issue Dec 27, 2011 · 1 comment
Open

(dev) Strange things on opened SVGs #14

linuslabo opened this issue Dec 27, 2011 · 1 comment

Comments

@linuslabo
Copy link

I don't really know how to open a new svg file, so for the moment I thought to just replace the blank.svg before loading Dizzy.......
When opening (this way) an existing svg made with Dizzy classes for the presentation (group_1, group_2, ecc..) that's what happens:

1
Presentation goes well if you don't modify the file.
2
transforming (transl, scaling or rotating) an element in default mode will teleport it inverting the TM and even if you transform it back, the presentation for it will be done transforming the canvas with the CTM of that element (not inverting it anymore)

I hope it's due to my trick to open another svg. please confirm

@linuslabo
Copy link
Author

SOLVED:
the prob were that in new Group created for existing group in the loaded svg, transformation contained already the inverted matrix of the group - node.parentNode.getTransformToElement(node) -, while in new ones transformation was the right one (not inverted, equal to the one in attribute 'transformation' of their dom)

Easily fixable inverting it, this way: in "js/dizzy/group.js"
{... var transformMatrix = node.parentNode.getTransformToElement(node); this.dom(node); this.transform = new Transformation(transformMatrix); this.transform.inverse(); <---------------- HERE ...}

And in "js/dizzy/canvas.js" (current()) we should invert the transformation matrix before transforming the canvas, this way:
{ ... var groupTransform = group.transformation(); var inverseTransform = Transformation.createTransform(groupTransform.matrix()); inverseTransform.inverse(); <-------------------- HERE ... }
that's all folks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant