Skip to main content
Participant
March 12, 2024
Question

Extendscript: Creating empty path, selecting it, then drawing with the pen tool, is inverted on Mac.

  • March 12, 2024
  • 1 reply
  • 215 views

This is a very, very niche issue, so bear with me. (Code at the bottom)

 

I've got a script that creates an empty Shape Layer, adds an empty Path to it, selects the path, then switches the tool to the Pen Tool.

Essentially, it quickly lets the user start drawing with the Pen Tool. (In more detail; it lets me control everything about the Shape Layer before the user starts drawing, from other properties . Not important, but I know people prefer a little bit more context).

 

The issue is: On a MAC (I think), the first click and drag of the pen tool goes in the opposite direction. (Basically, the In Tangent and Out Tangent is swapped, on the first vertex only).

Then every click after that is correct. This doesn't seem to happen on Windows, though I don't have enough computers/people to verify this.

 

This definitely seems to be a bug, as the more I fiddle with this, the more random behaviours that appear. But I wanted to ask if people have dealt with this issue?

 

Ultimately, I can (kind of) work around it. If I check if the OS is a Mac, then I can correct for this. However, if this isn't a mac/windows issue, I'd like a more local, guaranteed way to detect (via scripting) if this issue exists.


The code:

app.beginUndoGroup("Path Error")
var targetShapeLayer = app.project.activeItem.layers.addShape();
var targetPath = targetShapeLayer.property("Contents").addProperty("ADBE Vector Shape - Group")
    targetPath.selected = true;
    app.project.toolType = ToolType.Tool_Pen;
app.endUndoGroup();

 

With that code, I kept clicking and dragging downwards (out tangent pointing toward the bottom). But for some reason, the first vertex draws incorrectly:

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
March 13, 2024

Seems to work as expected for me, on Win 11.