lib/shoes/swt/arrow_painter.rb in shoes-swt-4.0.0.pre12 vs lib/shoes/swt/arrow_painter.rb in shoes-swt-4.0.0.rc1
- old
+ new
@@ -1,6 +1,7 @@
# frozen_string_literal: true
+
class Shoes
module Swt
class ArrowPainter < Common::Painter
def fill(gc)
gc.fill_path(path)
@@ -26,18 +27,18 @@
# head_bottom |/
#
body_left = @obj.translate_left + @obj.left - @obj.width * 0.5
body_right = @obj.translate_left + @obj.left + @obj.width * 0.1
- body_top = @obj.translate_top + @obj.top - @obj.width * 0.2
- body_bottom = @obj.translate_top + @obj.top + @obj.width * 0.2
+ body_top = @obj.translate_top + drawing_top - @obj.width * 0.2
+ body_bottom = @obj.translate_top + drawing_top + @obj.width * 0.2
- middle = @obj.translate_top + @obj.top
+ middle = @obj.translate_top + drawing_top
head_right = @obj.translate_left + @obj.left + @obj.width * 0.5
- head_top = @obj.translate_top + @obj.top - @obj.width * 0.4
- head_bottom = @obj.translate_top + @obj.top + @obj.width * 0.4
+ head_top = @obj.translate_top + drawing_top - @obj.width * 0.4
+ head_bottom = @obj.translate_top + drawing_top + @obj.width * 0.4
path = ::Swt::Path.new(::Swt.display)
path.move_to(body_left, middle)
path.line_to(body_left, body_top)
path.line_to(body_right, body_top)
@@ -51,9 +52,13 @@
path
end
end
def dispose
+ clear_path
+ end
+
+ def after_painted
clear_path
end
def clear_path
@path.dispose unless @path.nil? || @path.disposed?