I set the width and height for a TextBox in Fabric.js, but the value of the height I set didn't work. I don't know why. Is there a way to achieve a TextBox with a fixed width and height and prevent them from changing with the text inside it? Thanks for any help!!!
var canvas = (this.__canvas = new fabric.Canvas("c"));
canvas.uniformScaling = false;
var textBox = new fabric.Textbox("Freedom", {
left: 100,
top: 100,
width: 300,
height: 200,
fontSize: 20,
fontWeight: "bold",
fontStyle: "italic",
textAlign: "left",
editable: false,
hasControls: true,
editingBorderColor: "red",
fill: "red",
objectCaching: false,
lockScalingFlip: false,
borderColor: "black",
lockScalingY: false,
editable: true
});
textBox.setControlVisible("mtr", false);
canvas.add(textBox);
canvas.setActiveObject(textBox);
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/5.3.1/fabric.min.js"></script>
<canvas id="c" width="600" height="400" style="border:1px solid #ccc"></canvas>