index.js
/**
     * Draw lines weight into scene - helper function
     */
Draw lines weight into scene - helper function
Draw lines weight into scene - helper function
function showLinesWeight() {
        if(linesWeightContainer) {
            linesWeightContainer.destroy();
            render()
        }
        linesWeightContainer = new Container();
        root.addChild(linesWeightContainer);
        for (let i = 0; i < lines.length; i++) {
            if(lines[i].hidden){
                let number = new PIXI.Text(lines[i].weight.toString(), {fontSize:"15px", fill:"black"});
                let t = (CIRCLE_COUNT * 2) - 1;
                let f = i % t;
                if(f < CIRCLE_COUNT - 1) {
                    number.x = 95 + (f * CIRCLE_DISTANCE)
                    number.y = 45 + CIRCLE_DISTANCE * (Math.floor(i / t));
                } else {
                    number.x = 45 + ((f - CIRCLE_COUNT + 1) * CIRCLE_DISTANCE)
                    number.y = 95 + CIRCLE_DISTANCE * Math.floor(i / t);
                }
                linesWeightContainer.addChild(number);
            }
        }
    }
function showLinesWeight ( ) { if ( linesWeightContainer ) { linesWeightContainer . destroy ( ) ; render ( ) } linesWeightContainer = new Container ( ) ; root . addChild ( linesWeightContainer ) ; for ( let i = 0 ; i < lines . length ; i ++ ) { if ( lines [ i ] . hidden ) { let number = new PIXI . Text ( lines [ i ] . weight . toString ( ) , { fontSize : "15px" , fill : "black" } ) ; let t = ( CIRCLE_COUNT * 2 ) - 1 ; let f = i % t ; if ( f < CIRCLE_COUNT - 1 ) { number . x = 95 + ( f * CIRCLE_DISTANCE ) number . y = 45 + CIRCLE_DISTANCE * ( Math . floor ( i / t ) ) ; } else { number . x = 45 + ( ( f - CIRCLE_COUNT + 1 ) * CIRCLE_DISTANCE ) number . y = 95 + CIRCLE_DISTANCE * Math . floor ( i / t ) ; } linesWeightContainer . addChild ( number ) ; } } }
Draw lines weight into scene - helper function
Draw lines weight into scene - helper function
// Container for lines // Interate over all lines // Compute position where line weight should be placed