matt-curtis / Fluid-for-Sketch

[Sketch Plugin] Sketch-flavored Auto Layout-like Constraints
2.38k stars 73 forks source link

Adding constraints like in Xcode? #53

Open lucidlemon opened 8 years ago

lucidlemon commented 8 years ago

if this would be possible this plugin would be dope. What I mean by that exactly:

In XCode you can select a layer, hold ctrl, drag from your layer to the next layer above it for example and set the constraint to be the top spacing to the other layer.

I know this is very advanced, and I'm not sure if this is possible with the sketch plugin api or if they would have to do that on their own, but that would sick.

Thanks already for the current state of the plugin.

And a minor suggestion: could you check the box of a constraint automatically as soon as you enter a manual value?

imcatnoone commented 8 years ago

Hey @lucidlemon thanks so much for the feature request. As for your minor suggestion, it's a great one! Mind adding it as a separate ticket and labeling it under suggestion. Want to make sure the credit is visible/given if and when it is added. :smile:

lucidlemon commented 8 years ago

May a non-admin label issues? I know you can do that if you own the repo or have special rights, but I can't see the label interface for new issues :/ however, I'm gonna create a new issue for that, yeah :)

imcatnoone commented 8 years ago

@lucidlemon Hmm :confused: good question. Almost positive other folks have been the ones labeling their tickets but I could be going loopy? Give it a try when you create the new ticket. I'll keep an eye out for it. If it doesn't work, I'll add that in there. :+1:

lucidlemon commented 8 years ago

nope, tried it while creating #54 but had no luck. Maybe you have to be at least a collaborator to add labels.

matt-curtis commented 8 years ago

This is possible, but like you said, it would be quite involved. The problem is that there isn't a good, reliable way to identify layers despite changes to them (yet). Also getting geometry right (the position of a layer in the scroll view, based on document window position, drawing on top of it, figuring out what layer the mouse is over, and so on) would be a task.

As things currently stand, Fluid uses more of a procedural layer traversal technique to resolve constraints, versus some kind of identifier system, which is why you're currently limited to sibling/parent relativity. In the future, I'd like to try and get Fluid to actually leverage AutoLayout behind the scenes, which would make this kind of thing easier (but also comes with its own challenges for implementation).

lucidlemon commented 8 years ago

yeah already thought that this might be something harder to grab on. Maybe for version 13.37 ;) Thanks for your quick reply though.

Maybe Bohemion Coding approaches you after they basically ripped your webserver plugin in 3.4 :)