static/js/render.js
/**
 * Render shadows around selected contigs.
 * @function renderSelection
 * @param {Object} mo - main object
 * @see renderArena
 */
Render shadows around selected contigs.
@function renderSelection
@param {Object} mo - main object
@see renderArena
Render shadows around selected contigs . @function renderSelection @param { Object } mo - main object @see renderArena
function renderSelection(mo) {
  const view = mo.view,
        oray = mo.oray,
        pick = mo.picked;
  const w = oray.width,
        h = oray.height;
  const ctx = oray.getContext('2d');
  ctx.clearRect(0, 0, w, h);
  if (mo.cache.npick === 0) return;
  const n = mo.cache.nctg;
  if (!n) return;
  ctx.save();
  ctx.translate(view.posX, view.posY);
  ctx.scale(view.scale, view.scale);
  const color = mo.theme.selection;
  ctx.fillStyle = color;
  ctx.shadowColor = color;
  ctx.shadowBlur = 10; 
  ctx.shadowOffsetX = 0;
  ctx.shadowOffsetY = 0;
  const trans = mo.trans;
  const X = trans.x,
        Y = trans.y,
        S = trans.size;
  const pi2 = Math.PI * 2;
  let r, x, y;
  ctx.beginPath();
  for (let i = 0; i < n; i++) {
    if (!pick[i]) continue;
    r = Math.round(S[i]);
    x = Math.round(X[i] * w);
    y = Math.round(Y[i] * h);
    ctx.moveTo(x, y);
    ctx.arc(x, y, r, 0, pi2, true);
  }
  ctx.fill();
  ctx.restore();
}
function renderSelection ( mo ) { const view = mo . view , oray = mo . oray , pick = mo . picked ; const w = oray . width , h = oray . height ; const ctx = oray . getContext ( '2d' ) ; ctx . clearRect ( 0 , 0 , w , h ) ; if ( mo . cache . npick === 0 ) return ; const n = mo . cache . nctg ; if ( ! n ) return ; ctx . save ( ) ; ctx . translate ( view . posX , view . posY ) ; ctx . scale ( view . scale , view . scale ) ; const color = mo . theme . selection ; ctx . fillStyle = color ; ctx . shadowColor = color ; ctx . shadowBlur = 10 ; ctx . shadowOffsetX = 0 ; ctx . shadowOffsetY = 0 ; const trans = mo . trans ; const X = trans . x , Y = trans . y , S = trans . size ; const pi2 = Math . PI * 2 ; let r , x , y ; ctx . beginPath ( ) ; for ( let i = 0 ; i < n ; i ++ ) { if ( ! pick [ i ] ) continue ; r = Math . round ( S [ i ] ) ; x = Math . round ( X [ i ] * w ) ; y = Math . round ( Y [ i ] * h ) ; ctx . moveTo ( x , y ) ; ctx . arc ( x , y , r , 0 , pi2 , true ) ; } ctx . fill ( ) ; ctx . restore ( ) ; }
Render shadows around selected contigs.
Render shadows around selected contigs .
// clear overlay canvas // prepare canvas // define shadow style // note: canvas shadow blur is expensive // cache data // render shadows around selected contigs