vue-image-markup
vue-image-markup copied to clipboard
Using changeColor(colorProperty) while editing a Text object return a TypeError
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at klass.getFontCache (fabric.js?bec3:25307)
at klass._measureChar (fabric.js?bec3:25342)
at klass._getGraphemeBox (fabric.js?bec3:25446)
at klass._measureLine (fabric.js?bec3:25418)
at klass.measureLine (fabric.js?bec3:25395)
at klass.getLineWidth (fabric.js?bec3:25807)
at klass.calcTextWidth (fabric.js?bec3:25206)
at klass.initDimensions (fabric.js?bec3:25069)
at klass.callSuper (fabric.js?bec3:2208)
at klass.initDimensions (fabric.js?bec3:26710)
It works in this project's demo (https://image-markup.lionix-team.com) but we don't have access to the code is there a way to see it ?
Hi, you need to set the editor dimensions in mounted before setting the drawing mode:
this.$refs.editor.canvas.setDimensions({ width: this.canvasWidth, height: this.canvasHeight, });
Also apply
:canvasWidth="canvasWidth" :canvasHeight="canvasHeight"
to the editor and increase both to around
canvasWidth: 1000, canvasHeight: 1000,
Having the same issue. Moreover, this error happens when re-setting the 'text' tool while editing a text object. Any idea how to fix it ?
Also having the same issue as described by @aloggnet. Changing/updating a param while the text tool is specified and the text content/placeholder is highlighted causes the toLowerCase error as above.
@aloggnet @SethnBardsley @pierretsap I have found that specifically setting the fontStyle param to the default 'normal' fixes this issue for me.