0
votes

I am trying to resize elements in canavas using konva js plugin concept. But the resized width and height are not saved to database. My actual height width are not being replaced by resized height widths for any of the elements whether a image,layer,stage

1

1 Answers

0
votes

Do you change sizes with Konva.Transformer (https://konvajs.org/docs/vue/Transformer.html)?

If so - Transformer tool doesn't change width and height directly. Instead, it is changing scaleX and scaleY of a node. So you just need to save that attrs too into a database or change width/height to match new scaling:

const newWidth = rectangle.width() * rectangle.scaleX();
// set new width
rectangle.width(newWidth);

// reset scale:
rectangle.scaleX(1);