Is there way how to scale/resize entire canvas made in fabric.js ? I have <canvas className="canvas" ref="canvas" width="895" height="560"></canvas>
then const canvas = new fabric.Canvas(this.refs.canvas),
can i change width and height of canvas element and all objects inside ??
This question has been answered many times. The best answer on my opinion provided by one of fabricjs contributors Andrea Bogazzi here: https://stackoverflow.com/a/35019311/3710047
Basically, you can use fabricjs canvas methods:
canvas.setZoom(val);
canvas.setWidth(originalWidth * canvas.getZoom());
canvas.setHeight(originalHeight * canvas.getZoom());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With