diff options
| -rw-r--r-- | dalos.lua | 17 | 
1 files changed, 14 insertions, 3 deletions
| @@ -162,16 +162,22 @@ dalosp.canvas = {                  if self.stateful.rghtbutton then                      self.stateful.panning = true                  else -                    self.stateful.leftclk = self:findobj(x,y) +                    local obj, ind = self:findobj(x, y) +                    self.stateful.leftclk = obj +                    table.remove(self.objects, ind) +                    table.insert(self.objects, obj)                      self.ox, self.oy = x, y                      self.bx, self.by = x, y +                    self:draw()                  end              else                  if not self.stateful.linking and self.stateful.leftclk and not self.stateful.dragging then                      self.stateful.leftclk.obj:activate()                  elseif self.stateful.linking then                      local dest = self:findobj(x,y) -                    if dest == self.stateful.linking then +                    if not dest then +                        -- just do nothing, huh... +                    elseif dest == self.stateful.linking then                          self:setstatus(dalosp.canvas.stypes.ERROR, "Can't link: origin is the same as destination")                      elseif dest.obj.ninputs <= 0 then                          self:setstatus(dalosp.canvas.stypes.ERROR, "Can't link: destination has no input") @@ -195,9 +201,13 @@ dalosp.canvas = {                  if self.stateful.leftbutton then                      self.stateful.panning = true                  else -                    self.stateful.rghtclk = self:findobj(x, y) +                    local obj, ind = self:findobj(x, y) +                    self.stateful.rghtclk = obj +                    table.remove(self.objects, ind) +                    table.insert(self.objects, obj)                      self.ox, self.oy = x, y                      self.bx, self.by = x, y +                    self:draw()                  end              else                  if not self.stateful.moving and self.stateful.rghtclk and not self.stateful.dragging then @@ -297,6 +307,7 @@ dalosp.object = {          cv:Foreground(self.color)          cv:Box(x1, x2, y1, y2)          cv:Foreground(cd.BLACK) +        cv:Rect(x1, x2, y1, y2)          cv:TextAlignment(cd.SOUTH)          cv:Text(cx, y2, self.name)          cv:TextAlignment(cd.NORTH) | 
