Skip to content

Reloading custom fabricJS canvas objects from JSON? #6978

Answered by asturur
Milou6 asked this question in Q&A
Discussion options

You must be logged in to vote

Your code has an issue, is not following the polyline structure.
A polyline starts like this:

new fabric.Polyline(points, options)

And so the fromObject for the polyline specifically is:

  fabric.Polyline.fromObject = function(object, callback) {
    return fabric.Object._fromObject('Polyline', object, callback, 'points');
  };

Try to have the correct initialize function and a fromObject function that refer to points on the last argument, i assume it could fix your issues

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Milou6
Comment options

@asturur
Comment options

Answer selected by Milou6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants