简体   繁体   中英

Issue with selection-box after changing font-size (fabrics.js, Text)

i have come across an annoying bug in my fabric.js-editor:

The selection-box as well as the bounding area (the area you need to click on to select the object) are on the wrong position after changing the font-size of a text-object. (cf. images 1 & 2)

object-selection before:

在此处输入图片说明

object-selection after:

在此处输入图片说明

I would be very glad if someone knew how to fix this. Thank you!

 canvas.on("object:selected", function(options) { document.getElementById("setFontSize").onclick = function handleFontSizeEdit() { canvas.getActiveObject().set("fontSize", document.getElementById("fontSize").value); canvas.renderAll(); } 
 Font-Size: <input type="text" id="fontSize"> <input type="submit" id="setFontSize" value="Set"> 

SOLVED

I just realized that i was using an old version of fabric.js (1.1.0), after chanaging it to the current build (1.5) the problem with the selection box disappeared.

In case someone wants to see the code:

http://codepen.io/anon/pen/wGeaJj

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM