Edit in GitHubLog an issue

PathPointInfo

Used to create a PathPoint, which represents the anchor and control-handle endpoints for a path segment. Each point (the anchor point, left-direction point, and right-direction point) is an array containing X and Y position coordinates.

  • Use the JavaScript new operator to create these objects, and store them in the SubPathInfo.entireSubPath property before using that object to create a path item with PathItems.add()

  • The resulting SubPathItem object contains the resulting PathPoint objects. Use the PathPoint object to retrieve information about the points that describe existing path segments. The properties are read-only.

For paths that are straight segments (not curved), the coordinates of all three points are the same. For curved segments, the coordinates are different. The difference between the anchor point and the left or right direction points determines the arc of the curve. Use the left direction point to bend the curve "outward" or make it convex; or use the right direction point to bend the curve "inward" or make it concave.

PathPointInfo sample script#

Copied to your clipboard
1 function drawLine(doc: Document, start: number[], stop: number[]) {
2 const startPoint = new PathPointInfo();
3 startPoint.anchor = start;
4 startPoint.leftDirection = start;
5 startPoint.rightDirection = start;
6 startPoint.kind = Constants.PointKind.CORNERPOINT;
7
8 const stopPoint = new PathPointInfo();
9 stopPoint.anchor = stop;
10 stopPoint.leftDirection = stop;
11 stopPoint.rightDirection = stop;
12 stopPoint.kind = Constants.PointKind.CORNERPOINT;
13
14 const spi = new SubPathInfo();
15 spi.closed = false;
16 spi.operation = Constants.ShapeOperation.SHAPEXOR;
17 spi.entireSubPath = [startPoint, stopPoint];
18
19 const line = doc.pathItems.add("Line", [spi]);
20 line.strokePath(Constants.ToolType.PENCIL);
21 line.remove();
22 }
23
24 drawLine(app.activeDocument, [100,100], [200,200]);

Properties#

anchor#

anchor: number[]

The X and Y coordinates of the anchor point of the curve.


kind#

kind: PointKind

The role (corner or smooth) this point plays in the containing path segment.


leftDirection#

leftDirection: number[]

The location of the left-direction endpoint('in' position).


rightDirection#

rightDirection: number[]

The location of the right-direction endpoint('out' position).


typename#

Readonly typename: string

The class name of the referenced object

  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.