Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idea: toggle between visible, invisible and hidden #1

Closed
johanneseckert opened this issue Jul 26, 2014 · 5 comments
Closed

idea: toggle between visible, invisible and hidden #1

johanneseckert opened this issue Jul 26, 2014 · 5 comments

Comments

@johanneseckert
Copy link

I use bounding boxes to export buttons that need the same visual position and cannot be exported by just the artwork layers (e.g. a reload button doesn't sit centered in the bounding box because of its assymetric shape

What I use to enable layer exporting (no slices) is a non-visible bounding box (no fill etc) that will make sure the icon gets exported at 44×44pt.
This is also handy to space and position icons according to actual button positions.

Does that make sense?

@nitrada
Copy link
Member

nitrada commented Jul 26, 2014

But an "exportable" layer group ignores boundingBox layers, no matter if they are invisible, fill=hidden or fill.opacity=0, doesn't it? Or what's your trick? :)

We also did "boundingBox" layers with "fill = off", but since the style properties of a rectangle are "read-only" via Sketch API, we did it with the layer visibility for the plugin.

We do not often export assets via exportable layer groups though, so it wasn't a real issue yet.

@johanneseckert
Copy link
Author

yeah, you're right. a fill-les boundingBox is great for positioning elements on the canvas, but the export is still the bare icon.
for that, we need to create a slice the size of the boundingBox, isn't it?

I am still wondering why this isn't a native feature in sketch. And why are the style properties read-only @bomberstudios?

@bomberstudios
Copy link

Style properties are not read-only (unless I'm reading this thread wrong).

If you want to change, say, the opacity of a fill, you can do:

[[[[layer style] fill] color] setAlpha:0.2]

Generally speaking, a property called propertyName has to be set using a method named setPropertyName. For fills, there's a property called isEnabled, so if you wanted to disable a fill, you should do:

[[[layer style] fill] setIsEnabled:false]

Hope it helps!

@nitrada
Copy link
Member

nitrada commented Jul 31, 2014

thanks a lot @bomberstudios! I think we've been misguided by the doc here:
http://bohemiancoding.com/sketch/support/developer/03-reference/MSLayer.html

@frischmilch I think the "boundingBox" thing doesn't have to be a native feature, it's a pretty simple script and you can assign any shortcut. However, it would be great if the bounds of a rectangle with its fill disabled would be regarded when exporting via "exportable layer groups". This would make the boundingBox approach much more valuable.

@johanneseckert
Copy link
Author

you're script is fine! I was just thinking that as a tool used for UI design, Sketch could have some behaviors that do this »natively«, since it's something you would do in code when developing anways and my designs are much more accurate if I also respect the bounding box of the button. And the developers love it seeing spec'd out too :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants