Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pierretsap opened this issue Oct 26, 2021 · 4 comments

Comments

@pierretsap
Copy link

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
Copy link

SethnBardsley commented Jan 28, 2022

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
Copy link

aloggnet commented Mar 8, 2022

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
Copy link

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
Copy link

oliverseddon commented Nov 16, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants