Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

positioning programmatically #121

Open
jnoreiga opened this issue Apr 3, 2014 · 2 comments
Open

positioning programmatically #121

jnoreiga opened this issue Apr 3, 2014 · 2 comments

Comments

@jnoreiga
Copy link

jnoreiga commented Apr 3, 2014

Is there a way to programmatically set the position that you want your vector graphic moved to by providing an x, y coordinate? I also need to re size providing a height and width. I tried the code below but once I scale it's off. I know I'm missing something simple but my brain is fried working on this. Any help would be greatly appreciated.

position.top is the y coordinate I would like the vector graphic moved to in the canvas/image.

var newTranslateY = position.top - shape.freeTransform.attrs.y;
if (newTranslateY != shape.freeTransform.attrs.translate.y) {
shape.freeTransform.attrs.translate.y = newTranslateY;

      shape.freeTransform.apply();

}

@jnoreiga
Copy link
Author

jnoreiga commented Apr 7, 2014

Figured it out. Here is the code for anyone that else needs to know

http://jsfiddle.net/4eEeJ/

@zFedor
Copy link

zFedor commented Dec 14, 2016

Hi.

That example gives error VM86:140 Uncaught TypeError: svgDOM.getTransformToElement is not a function ...

Can you fix it ?
2016-12-14_1506

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

No branches or pull requests

2 participants