Inconsistencies on how the API reports line rotation vs what we show on the UI.
bomberstudios opened this issue · 0 comments
bomberstudios commented
As reported in https://sketchplugins.com/d/2067-strange-sketch-api-behaviors
Looks like we have an inconsistency on how we report rotation in the API vs how we do it on the UI.
If you draw a diagonal line at 45 degrees, Sketch's UI will show 45
on the Inspector.
However, this code will return 0
as the rotation:
const sketch = require('sketch')
let doc = sketch.getSelectedDocument()
let selection = doc.selectedLayers
console.log(selection.layers[0].transform.rotation) // JS API
console.log(selection.layers[0]._object.rotation()) // Raw access
If you now set the line's rotation to 0
using the Inspector, running the same code will now return an apparently random number...
Probably worth investigating both on the API side and on Sketch's side.