Class: SLComponents::Icon

Inherits:
NodeShape show all
Defined in:
lib/mk_semi_lattice/sl_components.rb

Instance Attribute Summary

Attributes inherited from NodeShape

#dx, #dy, #file_path, #fixed, #label, #linked, #name, #type, #x, #y

Instance Method Summary collapse

Methods inherited from NodeShape

#initialize

Constructor Details

This class inherits a constructor from SLComponents::NodeShape

Instance Method Details

#color=(c) ⇒ Object



60
61
62
# File 'lib/mk_semi_lattice/sl_components.rb', line 60

def color=(c)
  # 画像には直接色をつけられません
end

#setup_shapeObject



49
50
51
52
53
54
55
56
57
58
# File 'lib/mk_semi_lattice/sl_components.rb', line 49

def setup_shape
  p ["setup @icon_path", @icon_path]
  default_icon_path = '.semi_lattice/icons/file.png'
  icon_path = @icon_path && File.exist?(@icon_path) ? @icon_path : default_icon_path
  p ["icon_path", File.expand_path(icon_path)]
  @image = Image.new(
    icon_path,
    x: @x-60.48, y: @y-38.88, width: 120.96, height: 77.76, z: @z
  )
end

#x=(x) ⇒ Object



64
65
66
# File 'lib/mk_semi_lattice/sl_components.rb', line 64

def x=(x)
  @image.x = x - 60.48
end

#y=(y) ⇒ Object



68
69
70
# File 'lib/mk_semi_lattice/sl_components.rb', line 68

def y=(y)
  @image.y = y - 38.88
end