drawCharacter(key) {
        const charArray = GLOBALS.characterMapper.getArrayFor(key);
        console.log(charArray);

        let totalCirclesAdded = 0;
        for (let r = 0; r < charArray.length; r++) {
            const row = charArray[r];
            for (let c = 0; c < row.length; c++) {
                // the individual elements are truthy if a pixel is present
                if (row[c]) {
                    const circle = this._createCircle(CHAR_CIRCLE_RADIUS);

                    // TODO: calculate offset caused by padding in
                    // Calculate coordinates
                    // const xCoordinate = (GLOBALS.canvasCenterX / 2) + (c * OFFSET) + GLOBALS.cursorPosition.x;
                    const xCoordinate = (c * OFFSET) + GLOBALS.cursorPosition.x;
                    // const yCoordinate = (GLOBALS.canvasCenterY / 2) + (r * OFFSET) + GLOBALS.cursorPosition.y;
                    const yCoordinate = (r * OFFSET) + GLOBALS.cursorPosition.y;

                    // Tell the circle where it needs to go
                    circle.setDestination({ x: xCoordinate, y: yCoordinate });
                    circle.setBehavior(CircleBehavior.TRAVELING);
                    GLOBALS.circles[CircleBehavior.TRAVELING].push(circle);
                    totalCirclesAdded++;
                } // if
            } // for
        } // for

        // Now that the character has been drawn, add offset to give the illusion of typing.
        // Each circle is represented with a circle of radius X.
        GLOBALS.cursorPosition.x += charArray[0].length * CHAR_CIRCLE_RADIUS * KERNING_SCALAR;
        if (Math.abs(window.innerWidth - GLOBALS.cursorPosition.x) <= 500) {
            GLOBALS.cursorPosition.y += charArray[0].length * 10;
            GLOBALS.cursorPosition.x = 0;
        } // if
        return totalCirclesAdded;
    } // drawCharacter
/**
     * Draws key onto the canvas using Circle objects, and updates the "cursor" postion.
     * @param {string} key the character to draw
     * @return the number of circles added
     */
Draws key onto the canvas using Circle objects, and updates the "cursor" postion.
@param {string} key the character to draw
@return the number of circles added
Draws key onto the canvas using Circle objects and updates the " cursor " postion . @param { string } key the character to draw @return the number of circles added
drawCharacter(key) {
        const charArray = GLOBALS.characterMapper.getArrayFor(key);
        console.log(charArray);
        let totalCirclesAdded = 0;
        for (let r = 0; r < charArray.length; r++) {
            const row = charArray[r];
            for (let c = 0; c < row.length; c++) {
                if (row[c]) {
                    const circle = this._createCircle(CHAR_CIRCLE_RADIUS);
                    const xCoordinate = (c * OFFSET) + GLOBALS.cursorPosition.x;
                    const yCoordinate = (r * OFFSET) + GLOBALS.cursorPosition.y;
                    circle.setDestination({ x: xCoordinate, y: yCoordinate });
                    circle.setBehavior(CircleBehavior.TRAVELING);
                    GLOBALS.circles[CircleBehavior.TRAVELING].push(circle);
                    totalCirclesAdded++;
                } 
            } 
        } 
        GLOBALS.cursorPosition.x += charArray[0].length * CHAR_CIRCLE_RADIUS * KERNING_SCALAR;
        if (Math.abs(window.innerWidth - GLOBALS.cursorPosition.x) <= 500) {
            GLOBALS.cursorPosition.y += charArray[0].length * 10;
            GLOBALS.cursorPosition.x = 0;
        } 
        return totalCirclesAdded;
    } 
drawCharacter ( key ) { const charArray = GLOBALS . characterMapper . getArrayFor ( key ) ; console . log ( charArray ) ; let totalCirclesAdded = 0 ; for ( let r = 0 ; r < charArray . length ; r ++ ) { const row = charArray [ r ] ; for ( let c = 0 ; c < row . length ; c ++ ) { if ( row [ c ] ) { const circle = this . _createCircle ( CHAR_CIRCLE_RADIUS ) ; const xCoordinate = ( c * OFFSET ) + GLOBALS . cursorPosition . x ; const yCoordinate = ( r * OFFSET ) + GLOBALS . cursorPosition . y ; circle . setDestination ( { x : xCoordinate , y : yCoordinate } ) ; circle . setBehavior ( CircleBehavior . TRAVELING ) ; GLOBALS . circles [ CircleBehavior . TRAVELING ] . push ( circle ) ; totalCirclesAdded ++ ; } } } GLOBALS . cursorPosition . x += charArray [ 0 ] . length * CHAR_CIRCLE_RADIUS * KERNING_SCALAR ; if ( Math . abs ( window . innerWidth - GLOBALS . cursorPosition . x ) <= 500 ) { GLOBALS . cursorPosition . y += charArray [ 0 ] . length * 10 ; GLOBALS . cursorPosition . x = 0 ; } return totalCirclesAdded ; }
Draws key onto the canvas using Circle objects, and updates the "cursor" postion.
Draws key onto the canvas using Circle objects and updates the " cursor " postion .
// the individual elements are truthy if a pixel is present // TODO: calculate offset caused by padding in // Calculate coordinates // const xCoordinate = (GLOBALS.canvasCenterX / 2) + (c * OFFSET) + GLOBALS.cursorPosition.x; // const yCoordinate = (GLOBALS.canvasCenterY / 2) + (r * OFFSET) + GLOBALS.cursorPosition.y; // Tell the circle where it needs to go // if // for // for // Now that the character has been drawn, add offset to give the illusion of typing. // Each circle is represented with a circle of radius X. // if // drawCharacter