Sha256: d868441c17266bf3ad582a75c48b1a274f804d5dc6968caa74682a204692c7ea

Contents?: true

Size: 715 Bytes

Versions: 5

Compression:

Stored size: 715 Bytes

Contents

class CALayer
  def center
    NSMakePoint(left+width/2, top-height/2)
  end

  def center=(pt)
    #We need to check because pt might be HIPoint or some Boxed type
    pt = pt.to_point if pt.respond_to? :to_point
    f = frame
    f.origin.x = pt.x-width/2
    f.origin.y = pt.y-height/2
    self.frame = f
  end

  def top
    frame.origin.y + frame.size.height
  end

  def top=(y)
    f = frame
    f.origin.y = y - height
    self.frame = f
  end

  def bottom
    frame.origin.y
  end

  def bottom=(bottom)
    f = frame
    f.origin.y = bottom
    self.frame = f
  end

  def height=(height)
    f = frame
    f.origin.y -= height - frame.size.height
    f.size.height = height
    self.frame = f
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
purplish-frame-0.0.12 lib/purplish-frame/ui/osx/ca_layer.rb
purplish-frame-0.0.11 lib/purplish-frame/ui/osx/ca_layer.rb
purplish-frame-0.0.10 lib/purplish-frame/ui/osx/ca_layer.rb
purplish-frame-0.0.9 lib/purplish-frame/ui/osx/ca_layer.rb
purplish-frame-0.0.8 lib/purplish-frame/ui/osx/ca_layer.rb