<commit_before>// VIEW

var ImageTrack;
if( !ImageTrack ) ImageTrack = {};

/**
 * Tiled-image track subclass that displays images calculated from
 * wiggle data.  Has a scale bar in addition to the images.
 * @class
 * @constructor
 */
ImageTrack.Wiggle = function() {
    ImageTrack.apply( this, arguments );
};

ImageTrack.Wiggle.prototype = new ImageTrack({},{},{});

ImageTrack.Wiggle.prototype.updateStaticElements = function( coords ) {
    ImageTrack.prototype.updateStaticElements.apply( this, arguments );
    if( typeof coords.x == 'number' ) {
        this.yscale_left = coords.x + "px";
        if( this.yscale )
            this.yscale.style.left = this.yscale_left;
    }
};

ImageTrack.Wiggle.prototype.loadSuccess = function() {
    ImageTrack.prototype.loadSuccess.apply( this, arguments );
};

ImageTrack.Wiggle.prototype.makeImageLoadHandler = function( img, blockIndex, blockWidth ) {
    var superclass_handler = ImageTrack.prototype.makeImageLoadHandler.apply( this, arguments );
    return dojo.hitch( this, function() {
        superclass_handler();

        if(! this.yscale )
            this.makeYScale();
    });
};

ImageTrack.Wiggle.prototype.makeYScale = function() {
    // if we are not loaded yet, we won't have any metadata, so just return
    try {
        this.min   = this.store.metadata.global_min;
        this.max   = this.store.metadata.global_max;
        this.ticks = this.config.tick_marks;
    } catch (x) {
        return;
    }

    // make and style the main container div for the axis
    var rulerdiv = document.createElement('div');
    this.yscale = rulerdiv;
    rulerdiv.className = 'verticalRuler';
    dojo.style( rulerdiv, {
        height: this.imageHeight+'px',
        position: 'absolute',
        'z-index': 17,
        left: this.yscale_left,
        width: '30px'
    });
    switch (this.config.align) {
    case "top":
        rulerdiv.style.top = "0px";
        break;
    case "bottom":
    default:
        rulerdiv.style.bottom = this.trackPadding + "px";
        break;
    }
    this.div.appendChild( rulerdiv );

    // now make a Ruler and draw the axis in the div we just made
    this._renderScale( rulerdiv );
};

ImageTrack.Wiggle.prototype._renderScale = function( div ) {
    var ruler = new Ruler({
        min: this.min,
        max: this.max,
        direction: 'up'
    });
    ruler.render_to(div);
};<commit_msg>tweak ruler style, fix bug in z-index setting<commit_after>// VIEW

var ImageTrack;
if( !ImageTrack ) ImageTrack = {};

/**
 * Tiled-image track subclass that displays images calculated from
 * wiggle data.  Has a scale bar in addition to the images.
 * @class
 * @constructor
 */
ImageTrack.Wiggle = function() {
    ImageTrack.apply( this, arguments );
};

ImageTrack.Wiggle.prototype = new ImageTrack({},{},{});

ImageTrack.Wiggle.prototype.updateStaticElements = function( coords ) {
    ImageTrack.prototype.updateStaticElements.apply( this, arguments );
    if( typeof coords.x == 'number' ) {
        this.yscale_left = coords.x + "px";
        if( this.yscale )
            this.yscale.style.left = this.yscale_left;
    }
};

ImageTrack.Wiggle.prototype.loadSuccess = function() {
    ImageTrack.prototype.loadSuccess.apply( this, arguments );
};

ImageTrack.Wiggle.prototype.makeImageLoadHandler = function( img, blockIndex, blockWidth ) {
    var superclass_handler = ImageTrack.prototype.makeImageLoadHandler.apply( this, arguments );
    return dojo.hitch( this, function() {
        superclass_handler();

        if(! this.yscale )
            this.makeYScale();
    });
};

ImageTrack.Wiggle.prototype.makeYScale = function() {
    // if we are not loaded yet, we won't have any metadata, so just return
    try {
        this.min   = this.store.metadata.global_min;
        this.max   = this.store.metadata.global_max;
        this.ticks = this.config.tick_marks;
    } catch (x) {
        return;
    }

    // make and style the main container div for the axis
    var rulerdiv = document.createElement('div');
    this.yscale = rulerdiv;
    rulerdiv.className = 'ruler vertical_ruler';
    dojo.style( rulerdiv, {
        height: this.imageHeight+'px',
        position: 'absolute',
        left: this.yscale_left,
        width: '30px',
        zIndex: 17
    });
    dojo.style(
       rulerdiv,
       ( this.config.align == 'top' ? { top: '0px' } :
                                      { bottom: this.trackPadding+"px"})
    );
    this.div.appendChild( rulerdiv );

    // now make a Ruler and draw the axis in the div we just made
    this._renderScale( rulerdiv );
};

ImageTrack.Wiggle.prototype._renderScale = function( div ) {
    var ruler = new Ruler({
        min: this.min,
        max: this.max,
        direction: 'up'
    });
    ruler.render_to(div);
};
{'fraction_non_alphanumeric': 0.12455664510744836, 'fraction_numerical': 0.002086375964948884, 'mean_word_length': 2.651180502665651, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4191315', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1466, 'n_words': 356}