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

activeSelection coords not updating while changing the object position. #5357

Closed
AnurajRicky opened this issue Oct 30, 2018 · 2 comments
Closed

Comments

@AnurajRicky
Copy link

key('left', function (e) { let activeObject = canvasFabric.getActiveObjects(); if(activeObject.length !== 0){ e.preventDefault(); activeObject.forEach(function (object) { object.left -= 5; object.setCoords(); canvasFabric.renderAll(); }); } });

Originally posted by @AnurajRicky in #858 (comment)

@AnurajRicky
Copy link
Author

I found a solution

let activeObject = canvasFabric.getActiveObjects();
if (canvasFabric.getActiveObject().type === 'activeSelection') {
let groped = canvasFabric.getActiveObject().toGroup();
groped.left -= 5;
canvasFabric.renderAll();
canvasFabric.getActiveObject().toActiveSelection();
canvasFabric.requestRenderAll();
} else {
activeObject.forEach((object) => {
object.left -= 5;
canvasFabric.renderAll();
})
}

@asturur
Copy link
Member

asturur commented Nov 2, 2018

let activeObject = canvasFabric.getActiveObject();
activeObject.left -= 5;
activeObject.setCoords();
canvasFabric.renderAll();

Does not work always in any condition?

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

2 participants