Closed jbrennan closed 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
.
@andymatuschak I think this is good to go...Going to make separate issues for remaining tasks.
What it does
ShapeLayer
type that supports the visual display ofPath
objects.Path
type, a simplified wrapper for bezier paths for drawing lines and curves, either opened or closedUIBezierPath
.To do
frame
and thebounds
should be. Specifically, if I create a path likePath(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 of50, 50
, because that's the rectangle I gave when creating a path. But that kinda feels like a leaky abstraction too. What to do!Segment
type I made, but then I have to do some of the bezier math myself. I could instead just useUIBezierPath
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?