Sha256: 126f6d18bd19163072ffa229d392a97c08c26dd8f0bf8e7386727e910f965ea2

Contents?: true

Size: 1004 Bytes

Versions: 41

Compression:

Stored size: 1004 Bytes

Contents

# frozen_string_literal: true

new({ particle: :width, category: :geometry, type: :int })
new({ particle: :height, category: :geometry, type: :int })

new({ particle: :size, category: :geometry, type: :int }) do |params|
  params = { value: params } unless params.instance_of? Hash
  params[:recursive] ||= false
  params[:reference] ||= :x
  params[:target] ||= :self # :all resize atome + attached +distance between  to the value
  # self: resize the current atome to current value
  params[:propagate] ||= :raw # proportional atome children will be resize according
  # to its parent , raw apply the raw value to the attached atomes
  if params[:reference] == :x
    original_width = width
    width(params[:value])
    height(height * params[:value] / original_width)
  else
    original_height = height
    height(params[:value])
    width(width * params[:value] / original_height)
  end

  if params[:recursive]
    attached.each do |atome_id|
      grab(atome_id).size(params)
    end

  end

end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
atome-0.5.7.0.5 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.0.4 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.0.3 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.0.2 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.8.7 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.8.6 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.8.5 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.8.3 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.7.8 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.7.7 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.7.6 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.7.5 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.7.4 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.7.3 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.6.9 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.6.7 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.6.5 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.6.1 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.6.0 lib/atome/genesis/particles/geometry.rb
atome-0.5.6.5.7 lib/atome/genesis/particles/geometry.rb