[MetaballsKit] Make Field.size public and filter balls that lie outside the size when it changed
This commit is contained in:
parent
ee7bd497cc
commit
fc57f865f2
1 changed files with 7 additions and 1 deletions
|
@ -29,7 +29,13 @@ public struct Ball {
|
|||
}
|
||||
|
||||
public struct Field {
|
||||
var size: CGSize
|
||||
public var size: CGSize {
|
||||
didSet {
|
||||
// Remove balls that fall outside the new bounds.
|
||||
balls = balls.filter { bounds.contains($0.bounds) }
|
||||
}
|
||||
}
|
||||
|
||||
private(set) var balls = [Ball]()
|
||||
|
||||
internal var bounds: CGRect {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue