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

loadFromDatalessJSON : fill a SVG (from URL) with a gradient doesn't work #3989

Closed
Gulix opened this issue Jun 7, 2017 · 3 comments
Closed

Comments

@Gulix
Copy link

Gulix commented Jun 7, 2017

Version

1.7.6

Steps to reproduce

My engine loads a generated JSON with the loadFromDatalessJSON method. I reproduced the behavior with the Kitchensink demo tool. The JSON to load is in that pastebin : https://pastebin.com/jvnvGxPs

Expected Behavior

There's 4 objects displayed.
In Top Left corner, a path fully in JSON with a plain color. In Top Right corner, a path fully in JSON with a gradient.
In Bottom Left corner, a path coming from an external URL with a plain color. In Bottom Right corner, a path coming from an external URL with a gradient.

What is expected : the two objects on the left must be displayed with a plain color (Green), and the two on the right should have the gradient (Red-Blue).

Actual Behavior

The bottom right object is not correctly rendered. The gradient is not applied to the object coming from an external URL.

capture 20170607-1545-04

@asturur
Copy link
Member

asturur commented Jun 7, 2017

mmmm ok i ll take a look. i think i know what is it.
Just sorry that i just released 1.7.12 without this fix.

Be aware that pathGroups are deprectated, in 2.0 are removed. You will have just groups.

@asturur
Copy link
Member

asturur commented Jun 7, 2017

{
	"objects": [{
		"type": "path-group",
		"left": 0,
		"top": 0,
		"width": 600,
		"height": 600,
        "scaleX": 0.5,
        "scaleY": 0.5,
		"paths": [{
			"type": "path",
			"fill": "rgb(0,255,0)",
			"path": [
				["M", 300, 0],
				["a", 300, 300, 0, 0, 1, 0, 600],
				["a", 300, 300, 0, 0, 1, 0, -600],
				["z"],
				["M", 224, 296],
				["h", 152],
				["l", -76, -163],
				["z"],
				["M", 406, 360],
				["h", -212],
				["l", -53.5, 114.5],
				["a", 236.5, 236.5, 0, 0, 0, 319, 0],
				["z"],
				["M", 340, 67.5],
				["l", 164, 352],
				["a", 236.5, 236.5, 0, 0, 0, -164, -352],
				["z"],
				["M", 260, 67.5],
				["a", 236.5, 236.5, 0, 0, 0, -164, 352],
				["z"]
			]
		}]
	}, {
		"type": "path-group",
		"left": 300,
		"top": 0,
		"width": 600,
		"height": 600,
        "scaleX": 0.5,
        "scaleY": 0.5,
		"paths": [{
			"type": "path",
			"fill": {
				"type": "linear",
				"coords": {
					"x1": 0,
					"y1": 0,
					"x2": 500,
					"y2": 0
				},
				"colorStops": [{
					"offset": 1,
					"color": "rgb(0,255,255)",
					"opacity": 1
				}, {
					"offset": 0,
					"color": "rgb(255,0,0)",
					"opacity": 1
				}],
				"offsetX": 0,
				"offsetY": 0
			},
			"path": [
				["M", 300, 0],
				["a", 300, 300, 0, 0, 1, 0, 600],
				["a", 300, 300, 0, 0, 1, 0, -600],
				["z"],
				["M", 224, 296],
				["h", 152],
				["l", -76, -163],
				["z"],
				["M", 406, 360],
				["h", -212],
				["l", -53.5, 114.5],
				["a", 236.5, 236.5, 0, 0, 0, 319, 0],
				["z"],
				["M", 340, 67.5],
				["l", 164, 352],
				["a", 236.5, 236.5, 0, 0, 0, -164, -352],
				["z"],
				["M", 260, 67.5],
				["a", 236.5, 236.5, 0, 0, 0, -164, 352],
				["z"]
			]
		}]
	}, {
		"type": "path-group",
		"left": 0,
		"top": 300,
		"width": 600,
		"height": 600,
        "scaleX": 0.5,
        "scaleY": 0.5,
		"paths": [{
			"type": "path",
			"fill": "rgb(0,255,0)",
			"path": "https://upload.wikimedia.org/wikipedia/commons/7/7a/Anarchy-symbol.svg"
		}]
	}, {
		"type": "path-group",
		"left": 300,
		"top": 300,
		"width": 600,
		"height": 600,
        "scaleX": 0.5,
        "scaleY": 0.5,
		"paths": [{
			"type": "path",
			"fill": {
				"type": "linear",
				"coords": {
					"x1": 0,
					"y1": 0,
					"x2": 500,
					"y2": 0
				},
				"colorStops": [{
					"offset": 1,
					"color": "rgb(0,255,255)",
					"opacity": 1
				}, {
					"offset": 0,
					"color": "rgb(255,0,0)",
					"opacity": 1
				}],
				"offsetX": 0,
				"offsetY": 0
			},
			"path": "https://upload.wikimedia.org/wikipedia/commons/7/7a/Anarchy-symbol.svg"
		}]
	}]
}

keep here for faster access

@Gulix
Copy link
Author

Gulix commented Jun 8, 2017

Thanks for the reply. Will wait for the fix then ^^.

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