scripts/position.js
changeset 11 0faea3a6c881
parent 10 d3059e20b0fa
child 42 774751e7faed
equal deleted inserted replaced
10:d3059e20b0fa 11:0faea3a6c881
    14   
    14   
    15   var minX = $(base).Left() - 3;
    15   var minX = $(base).Left() - 3;
    16   var minY = $(base).Top() + 3;
    16   var minY = $(base).Top() + 3;
    17   var maxY = minY;
    17   var maxY = minY;
    18   var maxX = minX + $(base).Width() - 6;
    18   var maxX = minX + $(base).Width() - 6;
    19   Drag.init(slider, inner, minX, maxX, minY, maxY);
    19   Drag.init(slider, slider, minX, maxX, minY, maxY);
    20   
    20   
    21   inner.onDrag = posslide_handle_drag;
    21   slider.onDrag = posslide_handle_drag;
    22   inner.onDragEnd = posslide_handle_dragend;
    22   slider.onDragEnd = posslide_handle_dragend;
    23   inner.onDragStart = function(x, y) { pos_in_drag = true; };
    23   slider.onDragStart = function(x, y) { pos_in_drag = true; };
    24   base.onclick = posslide_handle_click;
    24   base.onclick = posslide_handle_click;
    25   
    25   
    26   posslide_set_position(0);
    26   posslide_set_position(0);
    27   slider.style.top = minY + 'px';
    27   slider.style.top = minY + 'px';
    28 }
    28 }
    33   var slider = document.getElementById('playhead-button');
    33   var slider = document.getElementById('playhead-button');
    34   var size = x - $(inner).Left() + 8;
    34   var size = x - $(inner).Left() + 8;
    35   if ( do_inner )
    35   if ( do_inner )
    36     inner.style.width = size + 'px';
    36     inner.style.width = size + 'px';
    37   if ( ( pos_in_drag && !do_inner ) || ( !pos_in_drag && do_inner ) )
    37   if ( ( pos_in_drag && !do_inner ) || ( !pos_in_drag && do_inner ) )
    38     slider.style.left = x + 'px';
    38     slider.style.left = ( x ) + 'px';
    39 }
    39 }
    40 
    40 
    41 var posslide_handle_dragend = function(x, y)
    41 var posslide_handle_dragend = function(x, y)
    42 {
    42 {
    43   pos_in_drag = false;
    43   pos_in_drag = false;