js/hicBrowser.js
/**
     * Used to synch state with other browsers
     * @param state  browser state
     */
Used to synch state with other browsers
@param state  browser state
Used to synch state with other browsers @param state browser state
syncState(syncState) {
        if(!syncState || false === this.synchable) return;
        if (!this.dataset) return;
        var chr1 = this.genome.getChromosome(syncState.chr1Name),
            chr2 = this.genome.getChromosome(syncState.chr2Name),
            zoom = this.dataset.getZoomIndexForBinSize(syncState.binSize, "BP"),
            x = syncState.binX,
            y = syncState.binY,
            pixelSize = syncState.pixelSize;
        if (!(chr1 && chr2)) {
            return;   
        }
        if (zoom === undefined) {
            zoom = this.findMatchingZoomIndex(syncState.binSize, this.dataset.bpResolutions);
            pixelSize = (syncState.pixelSize / syncState.binSize) * this.dataset.bpResolutions[zoom];
            x = (syncState.binX / syncState.pixelSize) * pixelSize;
            y = (syncState.binY / syncState.pixelSize) * pixelSize;
            if (pixelSize > MAX_PIXEL_SIZE) {
                console.log("Cannot synch map " + this.dataset.name + " (resolution " + syncState.binSize + " not available)");
                return;
            }
        }
        const zoomChanged = (this.state.zoom !== zoom);
        const chrChanged = (this.state.chr1 !== chr1.index || this.state.chr2 !== chr2.index);
        this.state.chr1 = chr1.index;
        this.state.chr2 = chr2.index;
        this.state.zoom = zoom;
        this.state.x = x;
        this.state.y = y;
        this.state.pixelSize = pixelSize;
        let event = HICEvent("LocusChange", {
            state: this.state,
            resolutionChanged: zoomChanged,
            chrChanged: chrChanged
        }, false)
        this.update(event)
    }
syncState ( syncState ) { if ( ! syncState || false === this . synchable ) return ; if ( ! this . dataset ) return ; var chr1 = this . genome . getChromosome ( syncState . chr1Name ) , chr2 = this . genome . getChromosome ( syncState . chr2Name ) , zoom = this . dataset . getZoomIndexForBinSize ( syncState . binSize , "BP" ) , x = syncState . binX , y = syncState . binY , pixelSize = syncState . pixelSize ; if ( ! ( chr1 && chr2 ) ) { return ; } if ( zoom === undefined ) { zoom = this . findMatchingZoomIndex ( syncState . binSize , this . dataset . bpResolutions ) ; pixelSize = ( syncState . pixelSize / syncState . binSize ) * this . dataset . bpResolutions [ zoom ] ; x = ( syncState . binX / syncState . pixelSize ) * pixelSize ; y = ( syncState . binY / syncState . pixelSize ) * pixelSize ; if ( pixelSize > MAX_PIXEL_SIZE ) { console . log ( "Cannot synch map " + this . dataset . name + " (resolution " + syncState . binSize + " not available)" ) ; return ; } } const zoomChanged = ( this . state . zoom !== zoom ) ; const chrChanged = ( this . state . chr1 !== chr1 . index || this . state . chr2 !== chr2 . index ) ; this . state . chr1 = chr1 . index ; this . state . chr2 = chr2 . index ; this . state . zoom = zoom ; this . state . x = x ; this . state . y = y ; this . state . pixelSize = pixelSize ; let event = HICEvent ( "LocusChange" , { state : this . state , resolutionChanged : zoomChanged , chrChanged : chrChanged } , false ) this . update ( event ) }
Used to synch state with other browsers
 @param state  browser state
Used to synch state with other browsers @param state browser state
// Can't be synched. // Get the closest zoom available and adjust pixel size.   TODO -- cache this somehow // Compute equivalent in basepairs / pixel // Translate bins so that origin is unchanged in basepairs //this.eventBus.post(event);