Khan / Prototope

Swift library of lightweight interfaces for prototyping, bridged to JS
http://khan.github.io/Prototope
230 stars 18 forks source link

Shapes #64

Closed jbrennan closed 9 years ago

jbrennan commented 9 years ago

What it does

andymatuschak commented 9 years ago

I'm still unclear what the relationship of the frame and the bounds should be. Specifically, if I create a path like Path(rectangle: Rect(x: 50, y: 50, width: 10, height 10)) and then create a shape layer with that path, I kind of expect the layer to have an origin of 50, 50, because that's the rectangle I gave when creating a path. But that kinda feels like a leaky abstraction too. What to do!

This is really unfortunate. Certainly the same dichotomy exists for CGPath / CAShapeLayer, but it's confusing and unpleasant there too. I think I didn't understand what you'd meant earlier about the frame/bounds issue when you'd mentioned it.

This seems like a significant vote for the idea that ShapeLayer and Path should be a single thing.

Path initializers aren't filled in yet. I could write these using the Segment type I made, but then I have to do some of the bezier math myself. I could instead just use UIBezierPath for those, but then I lose the ability to access segments / path points like if I'd just created the whole path manually. It's likely there's a simpler solution I'm just not seeing. Any ideas?

You can access the points of a UIBezierPath by using CGPathApply.

jbrennan commented 9 years ago

@andymatuschak I think this is good to go...Going to make separate issues for remaining tasks.