From 92fae00c7d284ac17d28bc0e54e73a1534c613a0 Mon Sep 17 00:00:00 2001 From: Craggar Date: Mon, 24 Aug 2020 10:40:28 +0100 Subject: Add a `distance_to` instance method on `GTK::Geometry` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `GTK::Geometry.distance` class method isn’t exposed at an instance level, but it would be a useful method to expose for instances including Geometry --- dragon/geometry.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dragon/geometry.rb b/dragon/geometry.rb index b16c5b7..607520f 100644 --- a/dragon/geometry.rb +++ b/dragon/geometry.rb @@ -128,6 +128,10 @@ S raise ":angle_given_point has been deprecated use :angle_from instead." end + def distance_to other_point + Geometry.distance(self, other_point) + end + # @gtk def self.shift_line line, x, y if line.is_a?(Array) || line.is_a?(Hash) -- cgit v1.2.3