lib/geomotion/cg_point.rb in geomotion-0.14.0 vs lib/geomotion/cg_point.rb in geomotion-0.15.0
- old
+ new
@@ -8,11 +8,11 @@
# size = CGSize.make width: 100, height: 100
# point = CPPoint.make x:0, y:10
# point.rect_of_size(size) # => CGRect([0, 10], [100, 100])
# point.rect_of_size([10, 20]) # => CGRect([10, 20], [100, 100])
def rect_of_size(size)
- CGRect.new([self.x, self.y], size)
+ CGRect.new(self, size)
end
# modified points
def left(dist = 0)
CGPoint.new(self.x - dist, self.y)
@@ -94,9 +94,13 @@
self.+(-other)
end
def inspect
"#{self.class.name}(#{self.x}, #{self.y})"
+ end
+
+ def to_ns_value
+ NSValue.valueWithCGPoint(self)
end
private
# this method allows us to do parallel assignment of #x and #y
def to_ary