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

Scaling node-fabricjs objects issue #1132

Closed
radiolondra opened this issue Mar 23, 2018 · 1 comment
Closed

Scaling node-fabricjs objects issue #1132

radiolondra opened this issue Mar 23, 2018 · 1 comment

Comments

@radiolondra
Copy link

radiolondra commented Mar 23, 2018

Node-Canvas version 1.6.10 on Ubuntu 16.04
Node Fabric version: 2.2.2
NodeJS version: 8.10.0

I need to scale the objects in the canvas (Textbox and Image fabric derived custom classes) to follow the new canvas width and height assigned in the node app. After this in the nodejs app I create a PNG file with the scaled objects.

Test Code on Github

The problem is that the generated PNG image (with scaled objects) seems to have all the objects badly scaled and positioned and I don't understand why.

wrong

Removing the scaling, I can see the objects are misplaced (wrong top/left)

noscale

In the browser version, using fabric 1.7.20 (so no nodeJS nor node-canvas, just javascript and HTML canvas), the PNG image is created with all the objects correctly scaled and positioned.

Maybe I'm assuming/doing something wrong. Maybe node-canvas does something differently or needs something. I don't know.

Any idea? Could you helpme?

Thanks
Rob

@zbjornson
Copy link
Collaborator

Can you simplify this down to just the minimum set of canvas API calls needed to reproduce the problem please?

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

No branches or pull requests

2 participants