GBrowse

 view release on metacpan or  search on metacpan

htdocs/js/track_configure.js  view on Meta::CPAN

    var current = el.value;
    var options = el.options;
    if (current < min) {
	for (var i=0;i<options.length;i++) {
	    if (options[i].value >= min) {
		el.value = options[i].value;
		return;
	    }
	}
    }
    else if (current > max) {
	for (var i=options.length-1;i>0;i--) {
	    if (options[i].value <= max) {
		el.value = options[i].value;
		return;
	    }
	}
    }
 },

 autoscale_select: function(scale_element,glyph_element) {
   var v=scale_element.value;
   var g=glyph_element.value;

   var autoscales = $('config_table').select('tr').findAll(function(a){return a.hasClassName('autoscale')});
   autoscales.each(function(a){a.hide()});
   if (g.match(/wiggle/) || g.match(/vista/) || g.match(/hybrid/)) {
       $('wiggle_autoscale').show();
   }
   else if (g.match(/xyplot/) || g.match(/density/) || g.match(/hybrid/)) {
       $('xyplot_autoscale').show();
   }

   var e=$('fixed_minmax');
   if (v=='none') {e.show()} else {e.hide()};

   var f=$('wiggle_z_fold');
   if (v=='z_score' || v=='clipped_global') {f.show()} else {f.hide()};
 },

 pivot_select: function(pivot_element) {
   var e=$('switch_point_other');
   var f=$$('tr.switch_point_color');
   if (pivot_element.value=='value'){
      e.show()
   } else{
      e.hide();
   }
   if (pivot_element.value=='none') {
      f.each(function(a){a.hide()});
      $('bgcolor_picker').show();
   } else {
     f.each(function(a){a.show()});
     $('bgcolor_picker').hide();
   }
  },


 set_opacity: function (opacity) {
	    var num = new Number(opacity);
	    if (isNaN(num)) num=0.5;
	    if (num > 1.0) num=1.0;
	    if (num < 0.0) num=0.0;
	    var thumb = $('opacity_thumb');
	    var right = $('opacity_box').getDimensions().width-thumb.getDimensions().width;    
	    thumb.style.left = num*right + 'px';
	    $$('img.opacity').each(function (e) {e.setOpacity(num)});
	    $('opacity_value').value=num.toFixed(2);
	},

 init: function (opacity) {
	    new Draggable('opacity_thumb',
                          {constraint:'horizontal',
			   snap: function(x,y,draggable) {
				  var parentDimensions = draggable.element.parentNode.getDimensions();
				  var left = 0;
				  var right=parentDimensions.width-draggable.element.getDimensions().width;
				  if (x < left)  x = left;
				  if (x > right) x = right;
				  return [x,y];
			      },
			   change: function(draggable) {
				  var el    = draggable.element;
				  var right = draggable.element.parentNode.getDimensions().width-el.getDimensions().width;
				  var percent = el.offsetLeft/right;
				  track_configure.set_opacity(percent);
			      }
			  }
			  );
	    this.set_opacity(opacity);
	    $('opacity_value').observe('change',function() {track_configure.set_opacity(this.value)});
	    $('format_option').observe('change',function() {track_configure.adjust_format(this)});
	    $('conf_color_series').observe('change',function() {track_configure.set_autocolors(this.checked)});
	    this.glyph_select($('config_table'),$('glyph_picker_id'));
	    this.adjust_opacity($('format_option').value);
	    this.set_autocolors($('conf_color_series').checked);
	}
});


var track_configure = new TrackConfigure;



( run in 0.979 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )