lionix-team / vue-image-markup

vue-image-markup will provide you to edit uploaded image easily and save it.
https://image-markup.lionix-team.com
96 stars 45 forks source link

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

Open pierretsap opened 2 years ago

pierretsap commented 2 years ago
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 ?

SethnBardsley commented 2 years ago

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,

aloggnet commented 2 years ago

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 ?

oliverseddon commented 1 year ago

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 commented 1 year ago

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