Sha256: 90f3526ab7bd8fbd8d89eda7bfa7f93701d49fded820f53b17a30bf2c5659442

Contents?: true

Size: 955 Bytes

Versions: 10

Compression:

Stored size: 955 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 + fasten +distance between  to the value
  params[:propagate] ||= :raw # proportional atome children will be resize according
  # to its parent , raw apply the raw value to the fasten atomes
  if params[:reference] == :x
    original_width = width
    width(params[:value])
    height(height * params[:value] / original_width) if value
  else
    original_height = height
    height(params[:value])
    width(width * params[:value] / original_height)
  end

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

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
atome-0.5.7.6.0 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.5.9 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.5.4 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.5.3 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.5.1 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.4.8 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.4.7 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.4.6 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.4.3 lib/atome/genesis/particles/geometry.rb
atome-0.5.7.4.2 lib/atome/genesis/particles/geometry.rb