From: Bryan Richardson <btrichardson / gmail.com>
Subject: Re: Ruby Tk Canvas Drawing
Date: Fri, 4 Apr 2008 06:35:55 +0900
Message-ID: <b5c8f55b404ca2eaf9aaef3291d3f857 / ruby-forum.com>
> Thanks for the help guys.  Is it possible to only move one end of a line 
> without moving the other end?

Of course. :-)
---------------------------------------------------------------------
def move_tail(line, dx, dy)
  coords = line.coords
  coords[-2] += dx
  coords[-1] += dy
  line.coords = coords
end

def set_tail(line, x, y)
  coords = line.coords
  coords[-2] = x
  coords[-1] = y
  line.coords = coords
end

def add_tail(line, x, y)
  line.coords <<= [x, y]
end

def remove_tail(line)
  coords = line.coords
  coords.pop; coords.pop
  line.coords = coords
end    
---------------------------------------------------------------------
-- 
Hidetoshi NAGAI (nagai / ai.kyutech.ac.jp)