Sha256: 9d29cce3360cd8320e8140783e6b75f71d087f23985f012b25623d69de1d8406
Contents?: true
Size: 905 Bytes
Versions: 6
Compression:
Stored size: 905 Bytes
Contents
# frozen_string_literal: true new({ particle: :width }) new({ particle: :height }) new({ particle: :size }) 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
6 entries across 6 versions & 1 rubygems