Sha256: d2f6de74aebe3f531e6d2c89f83a29f021df86c00e7e7506dd3ecdd1119fd535

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true


module Molecule
  def slider(params,&bloc)
    slider_width=params[:width] || 333
    cursor_width=33
    cursor_height=33
    left_pos=params[:left] || 0
    top_pos=params[:top] || 0
    attach_to= params[:attach] || :view
    cursor_left=0
    cursor_top=0
    slider=grab(attach_to).box({ top: top_pos, left: left_pos,width: slider_width, height: 25,  smooth: 9,  color:{red: 0.3, green: 0.3, blue: 0.3}})
    slider.shadow({
                    id: :s2,
                    left: 3, top: 3, blur: 9,
                    invert: true,
                    red: 0, green: 0, blue: 0, alpha: 0.7
                  })
    cursor= slider.circle({width: cursor_width, height: cursor_height, left: 2, top: 1, color:{red: 0.3, green: 0.3, blue: 0.3}})
    cursor.left(cursor_left)
    cursor.top(cursor_top)
    cursor.shadow({
                    id: :s4,
                    left: 1, top: 1, blur: 3,
                    option: :natural,
                    red: 0, green: 0, blue: 0, alpha: 0.6
                  })
    cursor.drag({ restrict: {max:{ left: slider_width-cursor_width, top: 0}} }) do |_event|
      value = (cursor.left+cursor.width)/slider_width*100
      bloc.call(value)
    end
    slider
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
atome-0.5.6.7.5 lib/molecules/intuition/sliders.rb