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

toSVG fails in presence of Textbox #2339

Closed
gunmetalremy opened this issue Jul 15, 2015 · 7 comments · Fixed by #2347
Closed

toSVG fails in presence of Textbox #2339

gunmetalremy opened this issue Jul 15, 2015 · 7 comments · Fixed by #2347
Labels

Comments

@gunmetalremy
Copy link
Contributor

I am trying out the new Textbox and when I call toSVG, I get "Uncaught RangeError: Maximum call stack size exceeded".

The error appears to be coming from callSuper method being triggered by _setSVGTextLineText. Looks like it's stuck in some kind of infinite loop.

@kangax
Copy link
Member

kangax commented Jul 15, 2015

/cc @jafferhaider @inssein

@inssein
Copy link
Contributor

inssein commented Jul 15, 2015

Ah that could be very easily true, I have never used the SVG functionality and probably didn't test it in the implementation. I am little bit swamped right now, but perhaps over the weekend I could try to take a look.

@asturur
Copy link
Member

asturur commented Jul 17, 2015

There is a loop in the callsuper i m not able to solve.
@kangax is there anyway we can callSuperSuper in an elegant way?
Also some modification are needed to get textbox working with latest changes:

  1. set the width in the array this.__lineWidths[]
  2. create StyleMap everytime splitTextLines is called
  3. search around for direct access to style object and replace with the methods that allows the textbox to use the stylemap

@jafferhaider
Copy link
Contributor

I had reported this callSuper issue in my original pull request as well. call super doesn't seem to work if the current class has a grandparent class. Only works if there is one level of inheritance.

As a work around I had manually called IText's function instead of using callSuper. Better solution is to redo callSuper to work with multiple levels of inheritance.

@asturur
Copy link
Member

asturur commented Jul 17, 2015

How did you call it manually? i tried but failed.
i tried fabric.Itext.functionName(.....) but getting no luck because i'm missing something.
can you share?

@asturur
Copy link
Member

asturur commented Jul 17, 2015

i found it:
fabric.Text.prototype._setSVGTextLineText.call(this,

  •          lineIndex, textSpans, height, textLeftOffset, textTopOffset);
    

i was doing
fabric.Text.prototype._setSVGTextLineText.apply(this,

  •          lineIndex, textSpans, height, textLeftOffset, textTopOffset);
    

and getting no luck.

@jafferhaider
Copy link
Contributor

@asturur Yep, that is what I was doing. Sorry for the delay in responding ... I was on vacation.

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

Successfully merging a pull request may close this issue.

5 participants