vue-image-markup icon indicating copy to clipboard operation
vue-image-markup copied to clipboard

Using changeColor(colorProperty) while editing a Text object return a TypeError

Open pierretsap opened this issue 3 years ago • 4 comments

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 ?

pierretsap avatar Oct 26 '21 11:10 pierretsap

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,

SethnBardsley avatar Jan 28 '22 08:01 SethnBardsley

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 ?

aloggnet avatar Mar 08 '22 08:03 aloggnet

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.

oliverseddon avatar Nov 16 '22 14:11 oliverseddon

@aloggnet @SethnBardsley @pierretsap I have found that specifically setting the fontStyle param to the default 'normal' fixes this issue for me.

oliverseddon avatar Nov 16 '22 15:11 oliverseddon