adobe-photoshop / generator-core

Core Node.js library for Adobe Photoshop CC's Generator extensibility layer
MIT License
692 stars 97 forks source link

Transformed shapes has no transform data #265

Open dirkschulze opened 10 years ago

dirkschulze commented 10 years ago

On free transforms on shapes like rectangles, there are no transform data preserved for the shape. The JSON export file doesn't even seem to make it clear if a transform is applied to a shape at all. So it is not even clear when to use the raw path data as fallback.

iwehrman commented 10 years ago

This is known a Photoshop issue. I believe @isonno has been looking into it on the native side. @isonno: is that true? or am I confusing this with something else? In any case, those changes would not percolate into main until at least 15.3.

isonno commented 10 years ago

@iwehrman - I did some code for Design Library so the text font size is reset to account for any scale transforms applied. Tai Luxon integraged this into DL. This is actually a significant issue, since a lot of designers use transforms to scale text to a particular size, rather than adjusting the point size.

jhatwich commented 10 years ago

@isonno this issue is for shapes/paths, not text.

From what I can tell there isn't a good way to separate the transform from the path either via the JSX APIs or from the generator data. The new getPathData flag seems to return transformed points.

In svgOMG, similar to getLayerSVG.jsx, we are getting transformed paths by using layerSVGcoordinateOffset and querying the layerVectorPointData attribute. It is less efficient to have to make a second JSX query to get the path data this way, but it is already formatted as an SVG path. We will need to render the path in order to move to getPathData.

If I start with a rectangle 100x50 and rotate it by 45deg I want to be able to write it that way in SVG. It should be a rectangle w/transform, not a path. As it stands right now, all the bounds are transformed including path.pathComponents.origin. It seems like adding the path.transform similar to text.transform would be enough to figure it out.

It seems like a bug that path.pathComponents.origin.bounds is transformed. What do you think?