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



57
58
59
# File 'lib/mk_semi_lattice/sl_components.rb', line 57

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

#setup_shapeObject



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

def setup_shape
  p ["setup @icon_path", @icon_path]
  icon_path = @icon_path && File.exist?(@icon_path) ? @icon_path : './icons/file.png'
  @image = Image.new(
    icon_path,
    x: @x-28, y: @y-20, width: 56, height: 36, z: @z
  )
end

#x=(x) ⇒ Object



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

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

#y=(y) ⇒ Object



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

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