summaryrefslogtreecommitdiffhomepage
path: root/dragon
diff options
context:
space:
mode:
authorCraggar <[email protected]>2020-08-24 10:40:28 +0100
committerAmir Rajan <[email protected]>2020-09-02 13:29:53 -0500
commit92fae00c7d284ac17d28bc0e54e73a1534c613a0 (patch)
treee328daf329ca9650c0b075ebb443d127a6c83fcf /dragon
parentb618bdd406a3817bcc53daed0612f79b2d9178f8 (diff)
downloaddragonruby-game-toolkit-contrib-92fae00c7d284ac17d28bc0e54e73a1534c613a0.tar.gz
dragonruby-game-toolkit-contrib-92fae00c7d284ac17d28bc0e54e73a1534c613a0.zip
Add a `distance_to` instance method on `GTK::Geometry`
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
Diffstat (limited to 'dragon')
-rw-r--r--dragon/geometry.rb4
1 files changed, 4 insertions, 0 deletions
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)