sketchplugins / plugin-requests

A collection of plugins requested to our Twitter account
https://twitter.com/sketch
MIT License
211 stars 64 forks source link

Can't set frame height #17

Closed juliussohn closed 6 years ago

juliussohn commented 6 years ago

document.selectedLayers.layers[0].frame.height=100 does not do anything. The layer exists and I can get the height etc. But I can't set it. Am I missing something?

bomberstudios commented 6 years ago

I just tried this and it works:

log(context.document.selectedLayers().layers()[0].frame().height())
// 200
context.document.selectedLayers().layers()[0].frame().height = 300
log(context.document.selectedLayers().layers()[0].frame().height())
// 300

BTW, for plugin-related questions, http://sketchplugins.com is a much better place to ask : )

juliussohn commented 6 years ago

@bomberstudios Thanks, but this is the old syntax, I would like to make the new work.

Thanks for the tip :)

bomberstudios commented 6 years ago

Then check https://github.com/BohemianCoding/SketchAPI : )

mathieudutour commented 6 years ago

Sounds like a bug. Can you open an issue https://github.com/BohemianCoding/SketchAPI ?

juliussohn commented 6 years ago

@mathieudutour I will!

Meanwhile to make it work you can use the sketchObject property of the layer:

 document.selectedLayers.layers[0].sketchObject.frame.height = 100