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

strokeColor and fillColor does not import data #392

Closed
khurramraheel opened this issue Jan 25, 2014 · 1 comment
Closed

strokeColor and fillColor does not import data #392

khurramraheel opened this issue Jan 25, 2014 · 1 comment

Comments

@khurramraheel
Copy link

I used a gradient on a path and called path's fillColor.exportJSON(), now after some manipulation, I am trying to reload the new gradient string in the path's fillColor but It seems that fillColor and strokeColor only provide exportJSON but not importJSON, so setting gradient string to the fillColor property seems not possible.

var gradientString = '[["dictionary",{"#12":["Gradient",[[[0.41569,1,0.27059],0.6],[[0.14118,0.54118,1],"0.7"]],false]}],["gradient",["#12"],[100,100],[300,200]]]';

I tried as follows

path.fillColor = gradientString;

and

path.fillColor = JSON.parse(gradientString);

@lehni
Copy link
Member

lehni commented Feb 14, 2016

This is finally all supported now, e.g.:

var json = [["dictionary",{"#5":["Gradient",[[[1,1,0],0],[[1,0,0],0.5],[[0,0,1],1]],false]}],["Color","gradient",["#5"],[339,196],[499,356]]];
var color = new Color();
console.log(color.importJSON(json) === color);
console.log(color);

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

No branches or pull requests

2 participants