Code Monkey home page Code Monkey logo

auto-layout's Introduction

Install Auto-Layout with Sketchpacks

📐 Responsive Design for Sketch

Auto-Layout is a plugin for Sketch that enables designers to design fully responsive artboards.

☝️ Features

  • 📍 Pins (Constraints) - Learn more
  • 🗄 Stacks (Flexbox) - Learn more
  • ⚡️ Updates in real time when dragging layers
  • 🖥 Easily generate an overview of all screen sizes
  • 💎 Supports Symbols
  • 📱 Supports Web/iOS/Android
  • 🚀 Export a live, responsive website using Launchpad plugin (included)

📺 Videos

📝 Blog posts

  • 📐 Auto-Layout Read
  • 🗄 Stacks (Flexbox) Read

🏃🏼 Install with Sketch Runner

  • With Sketch Runner, just go to the install command and search for Auto Layout. Runner allows you to manage plugins and do much more to speed up your workflow in Sketch. Download Runner here.

Install with Sketch Runner

Installation via Sketch Plugin Manager:

  1. In the 'Catalog' tab of the Sketch Plugin Manager window, click in the 'Search' field and type 'Auto Layout', to filter the list.
  2. You will see the 'Auto Layout' plugin listed at the top of the list. Click the 'Instal' button inside it.

📖 Documentation

Pins

Simple

Simple pinning allows to pin a layer to its parent with the following:

  • Top
  • Right
  • Bottom
  • Left
  • Center Horizontally
  • Center Vertically

When selecting a pin, Auto-Layout will set the pin constant value as the current pixel value.

For example if a layer is 20px from the right and you select Pin to Right, the right pin constant value will be set to 20px.

Once a pin is set, Auto-Layout will enforce the pin value when the artboard is resized.

For example if you pinned a layer to the right by 20px, you can resize the artboard by dragging its right side and you'll notice the layer always stays 20px from the right.

Pin to Parent

  • A Layer is always pinned to its Parent
  • A parent can be either an Artboard or a Group
  • Pinning betweein siblins can be achieved using Stacks

Layer in an Artboard

Layer in a Group

Advanced

  • To reveal the advanced pinning panel click Pins
  • You can pin a layer either by pixels or by percent.
  • Pixels values are in the left text boxes, Percent values are in the right text boxes.
  • Use the Toggle button to select which type of pinning.

Pinning by Pixels

Pinning by Percent

Size

Width & Height

You can set a Layer width and height by checking the width and height checkboxes.
When you check the width or height box, Auto-Layout will set the current value as the constraint value. The taken value will be either by pixels or by percent, depending on the current toggle state.

Min & Max

You can set the miniumum or maximum value of the width or the height of a Layer

Once set, the layer width or height will never exceed the min/max values, no matter what the Artboard size is.

To keep the layer pinned to the left rather from the right, set the width to % and uncheck Right pin.

Custom Height

In some cases you want to extend the height of an artboard further than the default platform screen sizes, in order to show how the design looks when the user scrolls down.

Auto-Layout will automatically recognize artboards that do not have default screen sizes and will never decrease their height to less than their original height.

Center

  • A centered Layer is always centered to its Parent
  • A parent can be either an Artboard or a Group

Center Horizontally

You can center a layer horizontally to its parent.

Center Vertically

You can center a layer vertically to its parent.

Stacks

What is a Stack?

A Stack is a special type of Group that defines the layout of its child Layers.

A Stack Group icon has a special Blue color and an indicator of its Direction.

How to Stack?

To Stack layers  or groups, select them and click the Stack button in Auto-Layout panel.

Stack Properties

A Stack has 3 properties:

  1. Direction: Defines if stacking of child Layers is Horizontal or Vertical.
  2. Alignment: Can be Top/Center/Bottom/Spread
  3. Spacing: Defines the spacing between each child Layer.

Direction

Defines if stacking of child Layers is Horizontal or Vertical.

Alignment

Can be Top/Center/Bottom/Spread

Spacing

Defines the spacing between each child Layer.

Stack Nesting

Stacks can be nested

Examples

Scaling Text Background

Sketch file

Tutorials

Walkthrough Video (29:09) by Pablo Stanley


Walkthrough Video (7:36) by Chris Slowik


Flex Grid Video (25:25)


Dynamic Buttons Blog Post by Giusè


Orientation

You can toggle all artboards by clicking the Orientation toggle button.

Presets

Presets are pre-defined Artboard sizes of real world screen sizes devices.
Once you've defined Auto-Layout on your design, you can easily change Artboard sizes to these presets.

iOS

Device Width Height Scale
iPhone 4 320 480 2
iPhone SE 320 568 2
iPhone 7 375 667 2
iPhone 7+ 414 736 3
iPad Air 768 1024 2
iPad Pro 1024 1366 2

** Scale means that the number of pixels is multiplied according to the scale value.**

  • For example in iPhone 7 the screen size is 375x667 points, but 750x1334 actual pixels since Scale is 2.

Android

Device Width Height
Android Phone 360 640
Android Tablet 7' 600 960
Android Tablet 9' 768 1024
Android Desktop 1280 850

Web

Device Width Height
Desktop HD 1440 1024
Desktop 1024 1024
Tablet Portrait 768 1024
Mobile Portrait 320 1024

Custom

Presets Editor

The Plugin comes with a default collection of presets mentioned above. However you can easily add, edit, import and export your own presets.

Import

  1. Click “Platform” -> “Custom”
  2. The “Presets Editor” shows up, click “Import”
  3. Navigate and select the collection json file
  4. Done!

Export

So you’ve made the effort to create a perfect collection of presets and now your colleagues are jealous. Lucky enough you can become the hero of the day by just exporting your collection and sharing it with them.

Keyboard Shortcuts

Present Keyboard Shortcuts settings

You can use the Default shortcuts or assign your own.

auto-layout's People

Contributors

adamkirkwood avatar avishic avatar nikolasklein avatar orarbel avatar rezafaizarahman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

auto-layout's Issues

Resizing doesn't respect locked aspect ratios

When pinning a locked aspect ratio layer's left and right sides to the canvas, resizing will stretch the layer only horizontally. Expected behavior would be to resize both the width and height proportionally.

prepare to export should turn stacks into normal groups

After preparing a document to export to other plugins
the stacked groups can cause issues:
unwanted relayouting can happen if you click around inside them.

this issue occurs if the symbol didnt contain a background color object covering the full measurements of the symbol (which technically should not be required, but thats a sketch issue itself),

but instead the symbol had a background color defined via the sidebar option.
(included in instance and export)

If all groups lost that behaviour i think it would serve the purpose of the feature.
since you kind of want a dumb file with

[bug] when aligning and resizing, respect pixel-fitting rules

I'm noticing a lot of decimal values when moving/resizing things. I understand the need for precision when applying percentages, but it ends up creating a complete mess of decimal values. This makes elements blurry and hard to recover, even when running the fit to pixel command. Pixel fitting, especially if explicitly turned on in Sketch settings, should supercede exact calculations in UI design.

bitmap

Feature request

Would it be possible to implement breakpoints, if sketch was appropriate by the user? A bit more to real responisve ;-)

Thanks for making AutoLayout possible!!!

Redundant plugins in plugin-directory with same manifest identifiers – breaks Sketch Plugin Manager

This might be a silly question, but I'm curious what the difference is between this repo and https://github.com/AnimaApp/Launchpad. Both are registered to the plugin-directory as separate plugins but they seem like they both contain Launchpad (formerly known as AutoLayout).

The reason I bring it up is because it seems like they would conflict with each other if the same user installed them both from Sketch Toolbox or Plugin Manager and they both use the same identifiers in their manifest.json file.

If they're meant to be distinctly different plugins, I'd suggest that they use different identifiers in their manifest since it confuses Sketch Plugin Manager when there are multiple plugins with the same identifier. This could possibly be related to #47.

If they're actually the same, I'd suggest removing one from the plugin-directory.

Version Installed by Plugin Managers is Buggy

Today I came across the Launchpad official page, and decided to manually install the plugin, instead of using one of the current plugin managers. Much to my surprise, after having reported several bugs here, the Launchpad plugin simply worked as advertised - no bugs at all!

So, I uninstalled it, and tried re-installing it using the 2 newest plugin managers: Sketchpacks and Sketch Plugin Manager. Both managers allow me to instal (supposedly) version 0.5.2 of 'Auto-Layout' - which supposedly should be the same plugin as 'Launchpad' (considering they both have the same version number and exactly the same feature set). However, installing 'Auto-Layout' via either one of the plugin managers installs the very buggy version reported previously. Downloading and installing 'Launchpad' manually, directly from its official page, instals a bug-free version.

It seems, therefore, that the plugin managers are installing a different version of the plugin, which needs to be updated with all the corrections already available in the official 'Launchpad' 0.5.2.

Please note also, that after installing Launchpad manually, if the user has one of the plugin managers installed, it will detect Launchpad as being an older version of 'Auto-Layout', and will try to update it - Sketch Plugin Manager does this every time you launch Sketch. Needless to say, if the user 'updates' the plugin, they will get the buggy version...

This affects issues #41, #42, #43, #44 and #45.

Auto-Layout Disclosure Triangle in Wrong Position in New Windows

When opening a document window, the Anima Panel defaults to open, with both LaunchPad and the Auto-Layout showing. The Auto-Layout panel is fully open - showing all advanced options - but its disclosure triangle is in the 'closed' position:

screen shot 2017-05-03 at 9 15 08 am

Toggling the Anima Panel - and forcing a redraw - seems to fix it.

[Feature] Copy settings from one object and paste onto another

Hi,

the plugin is great and I am sure that you are already working on improvements.
It would be nice if you can copy the autolayout settings from one object and paste onto another object.
Think like the "copy style" and "paste style" functionality in sketch.

Cheers,
Atilla

Crash when entering Presentation Mode

Hi there,

we have a bunch of reports of crashes in [MSTogglePresentationModeAction hideUIForPresentationMode:] when using AutoLayout and entering Presentation Mode.

We've been unable to replicate them, so maybe the issue has been fixed and these users haven't updated to the latest AutoLayout, but I thought I'd mention it in case it rings any bells on your side.

Thanks in advance!

Pinning does not resize when shrunken

When you pin an element and the item expands, the pinned element also grows (expected). But when you shrink the same element, it does not shrink (not expected). See example below:

2017-04-12 09_29_32

Auto-Layout resets resizing settings of text objects

In a sample provided here there is a text block. It is always reset from "Stretch" setting used to correctly resize it to "Float in place".

Curiously, tried loading file with Auto-Layout plugin disabled, resizing still worked as planned, but "resize" setting worked correctly on text block. So I guess it has something to do with plugin.

An interesting thing to note is that while setting is reset on subsequent object selection, it appears to behave rather correctly after being set to "stretch"

Center pins behaviour corrections

In current version of Auto Layout vertical and horizontal center pins work pretty different than side ones and I just can't understand the logic.

  1. When you assigning any center pin to randomly placed layer this layer changes it's position to center of it's container and you need to manually bring it back to it's original position to set proper distance value on pin. But if you pin layer to any side you'll just get a calculated distance value based on current layer position but the layer itself won't move.
  2. Another thing I can't understand is why it's not possible to set percentage distance value to center pins? I had several cases when this could be really useful for me.

So I believe that unification of center pins behaviour with side pins can make Auto Layout even more awesome!

Thanks for your attention.

Anima Panel Should Auto-Resize and Only Take Up Required Space

The new Anima Panel takes up over 50% of the Inspector, always - regardless of whether it needs it or not:

screen shot 2017-05-03 at 9 17 59 am

The expected behaviour would be that the panel should resize itself and move out of the way, as required - and not obtrusively impose itself over the Sketch panels whenever it's on-screen, even when it's taking up space that is obviously not required. This behaviour forces the user to continuously toggle the panel off in order to work...

Bug with Sketch file created on another computer

Came across this bug today. I needed to work in a Sketch file that was created by another user, on a different computer. When opening their file everything was good, but as soon as I select an artboard everything on it shifts positions. They do not have Auto Layout installed, I do, but with no settings activated.

I disabled Auto Layout, restarted Sketch, and the issue seems to be resolved.

things are not controllable

Hi,
This will be a general comment

  1. Thank you for your efforts. Flex Box like design is a huge idea especially after play and see webflow.
  2. Mostly design phrase is not controllable. Most of the time some weird behaviours prevent my designing and I can not move on.
  3. There should be some little tricks as far as I see and we don't know what they are. We have to explore and invent those ways. I think there should be a detailed guideline.
  4. After 4 hours and after 3 video tutorial, I can not achieve an e*commerce product list page with this tool. Especially nested groups and nested Stacks have issues that I could not understand.

This tool should help us to prevent loosing time as we designing a screen not just for breakpoints. Because screen adaptations are at the end of the designing process. After making a design we actually can make screen adaptations easier than designing.

if you make(actually DESIGN) a responsive grid with Auto Layout, after that phase with one shot you can prepare other screens, okay nice. But if you need to change grid design you have to prepare screens again. However changing design of a responsive grid with Auto Layout is not easy and not consistent.

For example please try to make a complex list. In this example (https://www.youtube.com/watch?v=DiCXg17CwIY&t=1225s) grid structure actually is not fully flexed. if you see sketch file there are some tricks in design and layer structure but I could not solved exactly and why I have to do that?

for example @24:20, he is tried to change text. After that right column image is shifted. You have to deal with that problem to use flexed grid properly. If you can not solve that, there is no need to use this because it takes time(much time than hoped)and the result is not consistent.

I have to make a file to demonstrate that actually I should make a video but currently there is no time for that.

thank you again for this grate tool at least thank you for serving a huge idea to softwares that we use.

[Docs] Please Add Instructions on How to Install via Sketch Plugin Manager

The Sketch Plugin Manager is an amazing project, combining the best of all plugin managers that came before it:

  • it is a normal Sketch plugin, that works inside Sketch's own 'Plugins' menu - i.e., it is not a separate app, and does not instal obtrusive menu items in your menubar.
  • it provides a beautiful, searchable, easy-to-use interface for users to find the plugins they need.
  • it automatically instals plugins listed in Sketch's official plugin directory, straight from the plugin's GitHub repo, requiring no configuration or special setup at all from the developer.
  • it automatically advises users when a plugin needs updating, and updates them automatically with a single click.
  • it provides the user with an easy-to-find, clickable link to your plugin homepage/GitHub repo.
  • it can uninstall plugins with a single click, too.

The instructions that your users would need in order to instal Launchpad via Sketch Plugin Manager are:

Installation via [Sketch Plugin Manager](https://mludowise.github.io/Sketch-Plugin-Manager/):

1. In the 'Catalog' tab of the Sketch Plugin Manager window, click in the 'Search' field and type 'Launchpad', to filter the list.
2. You will see the 'Launchpad' plugin listed at the top of the list. Click the 'Instal' button inside it.

Adding these instructions would greatly help popularise and support the project.

Not controlable not consistent

Hi,
This will be a general comment

  1. Thank you for your efforts. Flex Box like design is a huge idea especially after play and see webflow.
  2. Mostly design phrase is not controllable. Most of the time some weird behaviours prevent my designing and I can not move on.
  3. There should be some little tricks as far as I see and we don't know what they are. We have to explore and invent those ways. I think there should be a detailed guideline.
  4. After 4 hours and after 3 video tutorial, I can not achieve an e*commerce product list page with this tool. Especially nested groups and nested Stacks have issues that I could not understand.

This tool should help us to prevent loosing time as we designing a screen not just for breakpoints. Because screen adaptations are at the end of the designing process. After making a design we actually can make screen adaptations easier than designing.

if you make(actually DESIGN) a responsive grid with Auto Layout, after that phase with one shot you can prepare other screens, okay nice. But if you need to change grid design you have to prepare screens again. However changing design of a responsive grid with Auto Layout is not easy and not consistent.

For example please try to make a complex list. In this example (https://www.youtube.com/watch?v=DiCXg17CwIY&t=1225s) grid structure actually is not fully flexed. if you see sketch file there are some tricks in design and layer structure but I could not solved exactly and why I have to do that?

for example @24:20, he is tried to change text. After that right column image is shifted. You have to deal with that problem to use flexed grid properly. If you can not solve that, there is no need to use this because it takes time(much time than hoped)and the result is not consistent.

I have to make a file to demonstrate that actually I should make a video but currently there is no time for that.

thank you again for this grate tool at least thank you for serving a huge idea to softwares that we use.

Grouping discards layout settings of child

Steps:

  1. Create a layer
  2. Pin it to top, left, right
  3. Resize artboard to see it working
  4. Select layer and group it
  5. Resize artboard to see it has now lost all layout constraints

Expected:
Grouping one or more layers retains layout behavior.

Actual:
All constraints are discarded. The group has no layout constraints, and the contained layers also have no layout constraints.

Files:
Video
Sketch file before
Sketch file after

Anima App inactivate features

Would be great to activate/inactivate needed features of Anima app.

For example, i use only stacks, so i'd like to have only stacks functionality and nothing else.

Constraint to other layers

Something we use most in Interface Builder is being able to constraint to other views just like this:
http://d.pr/i/wbmP

[BUG] Some Anima Panel Menu Commands Crash Sketch

Steps to Reproduce

  1. Open an existing Sketch document. It will open with the Anima Panel already on the Inspector.
  2. Open the menu in the Anima Panel itself (by clicking the cog icon), and select one of these commands: "Sites Manager", "Send Feedback" or "My Account".

Result

Sketch crashes and quits - with a crash report window coming up.

I have not signed up for the LaunchPad service, so cannot tell whether having a LaunchPad account would make a difference.

Publishing Releases

Any chance of publishing your latest version as a tagged release on github?

[Bug] copy pasting between artboards improvement

currently it is possible to just copy a group or symbol with defined pins and paste on an other artboard with a different width and it magically applies the pins directly (also between different documents) ... this is SO SO COOL! BUT it does not work for the vertical pins ... e.g. bottom align = 0

also sometimes (i think when the artboard is smaller than the previous) - it applies the settings but places the element shifted to the left weirdly.

could you please look into it?
many thanks

'What's New' Command Shows Empty Change Log Window, Wrong Version Number

In version 0.5.0, selecting "Plugins -> LaunchPad by Anima -> Version -> What's New" produces the following window:

screen shot 2017-05-03 at 9 16 52 am

I'm guessing that considering the plugin is now at version 0.5.0, there should be something in the change log - and also, that it perhaps shouldn't tell me that I'm on version 0.0.3...

Drag objects and import SVG files

It seems to be Auto-layout plugin is not allowing drag objects of the Sketch document and also is collapsing whole Sketch app when it tries to open and import SVG files

textwitdh is broken

Without the plugin when I create a text layer on sketch I can change the width of the text layer
When the plugin is installed and I create a text layer then I can resize the width anymore.

Here is the video of the issue
textwidth-broken.mp4.zip

Export to Xib

Would be a great feature to be able to export artboard with autolayout to xib file.

Dynamic Width Bug

Each time when i set the dynamic width of an object [bound] to i.e. 24px / 100% which is inside a group, each time i select the parent group of this object, it automatically adds 24px to the object X, where it clearly should not.

What i'm trying to do, is that that based on width of text layer [title] dynamically resize the background [bound] with paddings 12/12 on sides.

screenshot 2017-05-03 10 07 11

feature request: sorting layer order of stacked elements

While the stack feature itself is already a huge time saver, one thing I was asked within my current project was to make sure the layer order in the layer list matches the visual one.
Currently these 2 are not relating to each other – In some cases this may be necessary, in order to have an element be "infront of all others" no matter position/order.

In my case this would seem to be more of an exception though.
However, I would suggest an option/toggle as part of the stack properties that automaticly changes the order within the layer list aswell.

What do u think about this?

Support Sketch 45 plugin update system

Hi there!

This is a quick note to remind you that Sketch 45 will include a plugin update system.

It would be awesome if you could add support to it (it's really easy!) before Sketch 45 comes out. Ideally, you should release an update for your plugin while we're still in Sketch 44, so your users will have a nice & easy experience when 45 is released.

For more details, please check http://sketchplugins.com/d/229-updating-plugins and http://developer.sketchapp.com/introduction/updating-plugins/

Thanks in advance!

Anima Panel Shows Redraw Glitch When Opening New Doc Window

Steps to Reproduce

  1. Open an existing Sketch document - it will open with the Anima Panel already showing
  2. While leaving the document window open, open a second document.

Result

The Anima Panel shows an ugly redraw issue in the second document window - it seems the 'Inner Shadow' and 'Gaussian Blur' panel titles are drawn over Anima Panel's:

screen shot 2017-05-03 at 9 21 45 am

Workaround

Doing anything that forces a screen redraw - eg., clicking in one of the Inspector panels - fixes the glitch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.