view x/static/js/8856.4593419f.chunk.js.map @ 125:49f3d3878413 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author fubar
date Sat, 05 Oct 2024 23:58:05 +0000
parents
children
line wrap: on
line source

{"version":3,"file":"static/js/8856.4593419f.chunk.js","mappings":"4NA2BO,SAASA,EAAcC,IAC5BC,EAAAA,EAAAA,aACED,GACAE,EAAAA,EAAAA,UAAQ,KACN,MAAMC,GAAOC,EAAAA,EAAAA,mBAAkBJ,GAC/B,IAAKG,EAAKE,YACR,OAEF,MAAMC,EAAON,EAAKO,YAAYC,WAAW,MACnCC,EAAOT,EAAKU,qBAAqBF,WAAW,MAClD,IAAKF,IAASG,EACZ,OAGF,MAAME,EAASR,EAAKS,wBACdC,EAAQV,EAAKU,MACnBP,EAAKQ,UAAU,EAAG,EAAGD,EAAOF,GAC5BF,EAAKK,UAAU,EAAG,EAAGD,EAAOF,IAC5BI,EAAAA,EAAAA,IAAQf,EAAMM,EAAMG,EAAK,MAI7BR,EAAAA,EAAAA,aACED,GACAE,EAAAA,EAAAA,UAAQ,MACOE,EAAAA,EAAAA,mBAAkBJ,GACrBK,cAGVW,EAAAA,EAAAA,IAAqBhB,EAAK,MAS9BC,EAAAA,EAAAA,aACED,GACAiB,EAAAA,EAAAA,WACE,KACE,MAAMd,GAAOC,EAAAA,EAAAA,mBAAkBJ,GAC/B,MAAO,CACLkB,QAASf,EAAKgB,MAAMC,KAAIC,GAAKA,EAAEH,UAI/BI,iBAAkBC,KAAKC,UACrBrB,EAAKgB,MAAMC,KAAIC,GAAKA,EAAEC,oBAExBG,SAAUzB,EAAKyB,SACfpB,YAAaF,EAAKE,YACnB,IAEH,EAAGA,kBACD,IAAKA,EACH,OAEF,MAAM,gBAAEqB,IAAoBC,EAAAA,EAAAA,YAAW3B,GAEjC4B,GADOxB,EAAAA,EAAAA,mBAAkBJ,GACRmB,MAAMC,KAAIjB,IAA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AC1CI,IACFtI,EAAI8G,UAAY,kBAChBhH,EAAAA,EAAAA,IAAgB,CACdI,GAAIF,IACFA,EAAIsC,MAAM,EAEZvC,QAASuI,EACTtI,MACAI,WACAC,UAAWtE,EAAKU,MAChB0D,aACAF,UACA1D,YAGJ,MAAMiM,EAAW7F,EAAM4F,QAAQN,GAAW,IACtCO,IACFxI,EAAI+G,YAAc,qBAElBjH,EAAAA,EAAAA,IAAgB,CACdI,GAAIF,IACFA,EAAI2B,QAAQ,EAEd5B,QAASyI,EACTxI,MACAI,WACAC,UAAWtE,EAAKU,MAChB0D,aACAF,UACA1D,WAGN,C","sources":["../../../plugins/linear-comparative-view/src/LinearSyntenyDisplay/afterAttach.ts","../../../plugins/linear-comparative-view/src/LinearSyntenyDisplay/components/util.ts","../../../plugins/linear-comparative-view/src/LinearSyntenyDisplay/drawSynteny.ts"],"sourcesContent":["import { addDisposer, getSnapshot } from 'mobx-state-tree'\n\nimport { Feature, getContainingView, getSession } from '@jbrowse/core/util'\nimport { bpToPx } from '@jbrowse/core/util/Base1DUtils'\nimport { MismatchParser } from '@jbrowse/plugin-alignments'\nimport { reaction, autorun } from 'mobx'\n\n// locals\nimport { LinearSyntenyViewModel } from '../LinearSyntenyView/model'\nimport { drawMouseoverSynteny, drawRef } from './drawSynteny'\nimport { LinearSyntenyDisplayModel } from './model'\n\ninterface Pos {\n  offsetPx: number\n}\n\ninterface FeatPos {\n  p11: Pos\n  p12: Pos\n  p21: Pos\n  p22: Pos\n  f: Feature\n  cigar: string[]\n}\n\ntype LSV = LinearSyntenyViewModel\n\nexport function doAfterAttach(self: LinearSyntenyDisplayModel) {\n  addDisposer(\n    self,\n    autorun(() => {\n      const view = getContainingView(self) as LinearSyntenyViewModel\n      if (!view.initialized) {\n        return\n      }\n      const ctx1 = self.mainCanvas?.getContext('2d')\n      const ctx3 = self.cigarClickMapCanvas?.getContext('2d')\n      if (!ctx1 || !ctx3) {\n        return\n      }\n\n      const height = view.middleComparativeHeight\n      const width = view.width\n      ctx1.clearRect(0, 0, width, height)\n      ctx3.clearRect(0, 0, width, height)\n      drawRef(self, ctx1, ctx3)\n    }),\n  )\n\n  addDisposer(\n    self,\n    autorun(() => {\n      const view = getContainingView(self) as LinearSyntenyViewModel\n      if (!view.initialized) {\n        return\n      }\n      drawMouseoverSynteny(self)\n    }),\n  )\n\n  // this attempts to reduce recalculation of feature positions drawn by\n  // the synteny view\n  //\n  // uses a reaction to say \"we know the positions don't change in any\n  // relevant way unless bpPerPx changes or displayedRegions changes\"\n  addDisposer(\n    self,\n    reaction(\n      () => {\n        const view = getContainingView(self) as LSV\n        return {\n          bpPerPx: view.views.map(v => v.bpPerPx),\n\n          // stringifying 'deeply' accesses the displayed regions, see\n          // issue #3456\n          displayedRegions: JSON.stringify(\n            view.views.map(v => v.displayedRegions),\n          ),\n          features: self.features,\n          initialized: view.initialized,\n        }\n      },\n      ({ initialized }) => {\n        if (!initialized) {\n          return\n        }\n        const { assemblyManager } = getSession(self)\n        const view = getContainingView(self) as LSV\n        const viewSnaps = view.views.map(view => ({\n          ...getSnapshot(view),\n          width: view.width,\n          staticBlocks: view.staticBlocks,\n          interRegionPaddingWidth: view.interRegionPaddingWidth,\n          minimumBlockWidth: view.minimumBlockWidth,\n        }))\n\n        const map = [] as FeatPos[]\n        const feats = self.features || []\n\n        for (const f of feats) {\n          const mate = f.get('mate')\n          let f1s = f.get('start')\n          let f1e = f.get('end')\n          const f2s = mate.start\n          const f2e = mate.end\n\n          if (f.get('strand') === -1) {\n            ;[f1e, f1s] = [f1s, f1e]\n          }\n          const a1 = assemblyManager.get(f.get('assemblyName'))\n          const a2 = assemblyManager.get(mate.assemblyName)\n          const r1 = f.get('refName')\n          const r2 = mate.refName\n          const ref1 = a1?.getCanonicalRefName(r1) || r1\n          const ref2 = a2?.getCanonicalRefName(r2) || r2\n          const v1 = viewSnaps[0]!\n          const v2 = viewSnaps[1]!\n          const p11 = bpToPx({ self: v1, refName: ref1, coord: f1s })\n          const p12 = bpToPx({ self: v1, refName: ref1, coord: f1e })\n          const p21 = bpToPx({ self: v2, refName: ref2, coord: f2s })\n          const p22 = bpToPx({ self: v2, refName: ref2, coord: f2e })\n\n          if (\n            p11 === undefined ||\n            p12 === undefined ||\n            p21 === undefined ||\n            p22 === undefined\n          ) {\n            continue\n          }\n\n          const cigar = f.get('CIGAR') as string | undefined\n          map.push({\n            p11,\n            p12,\n            p21,\n            p22,\n            f,\n            cigar: MismatchParser.parseCigar(cigar),\n          })\n        }\n\n        self.setFeatPositions(map)\n      },\n      { fireImmediately: true },\n    ),\n  )\n}\n","import React from 'react'\nimport {\n  assembleLocString,\n  doesIntersect2,\n  getSession,\n  isSessionModelWithWidgets,\n  Feature,\n  getContainingTrack,\n  getContainingView,\n} from '@jbrowse/core/util'\n\n// locals\nimport { getId, MAX_COLOR_RANGE } from '../drawSynteny'\nimport { LinearSyntenyDisplayModel } from '../model'\n\ninterface Pos {\n  offsetPx: number\n}\n\nexport interface ClickCoord {\n  clientX: number\n  clientY: number\n  feature: { f: Feature }\n}\n\ninterface FeatPos {\n  p11: Pos\n  p12: Pos\n  p21: Pos\n  p22: Pos\n  f: Feature\n  cigar: string[]\n}\n\nexport function drawMatchSimple({\n  feature,\n  ctx,\n  offsets,\n  cb,\n  height,\n  drawCurves,\n  oobLimit,\n  viewWidth,\n  hideTiny,\n}: {\n  feature: FeatPos\n  ctx: CanvasRenderingContext2D\n  offsets: number[]\n  oobLimit: number\n  viewWidth: number\n  cb: (ctx: CanvasRenderingContext2D) => void\n  height: number\n  drawCurves?: boolean\n  hideTiny?: boolean\n}) {\n  const { p11, p12, p21, p22 } = feature\n\n  const x11 = p11.offsetPx - offsets[0]!\n  const x12 = p12.offsetPx - offsets[0]!\n  const x21 = p21.offsetPx - offsets[1]!\n  const x22 = p22.offsetPx - offsets[1]!\n\n  const l1 = Math.abs(x12 - x11)\n  const l2 = Math.abs(x22 - x21)\n  const y1 = 0\n  const y2 = height\n  const mid = (y2 - y1) / 2\n  const minX = Math.min(x21, x22)\n  const maxX = Math.max(x21, x22)\n\n  if (!doesIntersect2(minX, maxX, -oobLimit, viewWidth + oobLimit)) {\n    return\n  }\n\n  // drawing a line if the results are thin: drawing a line results in much\n  // less pixellation than filling in a thin polygon\n  if (l1 <= 1 && l2 <= 1) {\n    // hideTiny can be used to avoid drawing mouseover for thin lines in this\n    // case\n    if (!hideTiny) {\n      ctx.beginPath()\n      ctx.moveTo(x11, y1)\n      if (drawCurves) {\n        ctx.bezierCurveTo(x11, mid, x21, mid, x21, y2)\n      } else {\n        ctx.lineTo(x21, y2)\n      }\n      ctx.stroke()\n    }\n  } else {\n    draw(ctx, x11, x12, y1, x22, x21, y2, mid, drawCurves)\n    cb(ctx)\n  }\n}\n\nexport function draw(\n  ctx: CanvasRenderingContext2D,\n  x1: number,\n  x2: number,\n  y1: number,\n  x3: number,\n  x4: number,\n  y2: number,\n  mid: number,\n  drawCurves?: boolean,\n) {\n  if (drawCurves) {\n    drawBezierBox(ctx, x1, x2, y1, x3, x4, y2, mid)\n  } else {\n    drawBox(ctx, x1, x2, y1, x3, x4, y2)\n  }\n}\n\nexport function drawBox(\n  ctx: CanvasRenderingContext2D,\n  x1: number,\n  x2: number,\n  y1: number,\n  x3: number,\n  x4: number,\n  y2: number,\n) {\n  ctx.beginPath()\n  ctx.moveTo(x1, y1)\n  ctx.lineTo(x2, y1)\n  ctx.lineTo(x3, y2)\n  ctx.lineTo(x4, y2)\n  ctx.closePath()\n  ctx.fill()\n}\n\nexport function drawBezierBox(\n  ctx: CanvasRenderingContext2D,\n  x1: number,\n  x2: number,\n  y1: number,\n  x3: number,\n  x4: number,\n  y2: number,\n  mid: number,\n) {\n  const len1 = Math.abs(x1 - x2)\n  const len2 = Math.abs(x1 - x2)\n\n  // heuristic to not draw hourglass inversions with bezier curves when they\n  // are thin and far apart because it results in areas that are not drawn well\n  // demo https://codesandbox.io/s/fast-glitter-q3b1or?file=/src/index.js\n  if (len1 < 5 && len2 < 5 && x2 < x1 && Math.abs(x1 - x3) > 100) {\n    const tmp = x1\n    x1 = x2\n    x2 = tmp\n  }\n  ctx.beginPath()\n  ctx.moveTo(x1, y1)\n  ctx.lineTo(x2, y1)\n  ctx.bezierCurveTo(x2, mid, x3, mid, x3, y2)\n  ctx.lineTo(x4, y2)\n  ctx.bezierCurveTo(x4, mid, x1, mid, x1, y1)\n  ctx.closePath()\n  ctx.fill()\n}\n\nexport function onSynClick(\n  event: React.MouseEvent,\n  model: LinearSyntenyDisplayModel,\n) {\n  const view = getContainingView(model)\n  const track = getContainingTrack(model)\n  const ref1 = model.clickMapCanvas\n  const ref2 = model.cigarClickMapCanvas\n  if (!ref1 || !ref2) {\n    return\n  }\n  const rect = ref1.getBoundingClientRect()\n  const ctx1 = ref1.getContext('2d')\n  const ctx2 = ref2.getContext('2d')\n  if (!ctx1 || !ctx2) {\n    return\n  }\n  const x = event.clientX - rect.left\n  const y = event.clientY - rect.top\n  const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data\n  const unitMultiplier = Math.floor(MAX_COLOR_RANGE / model.numFeats)\n  const id = getId(r1!, g1!, b1!, unitMultiplier)\n  const feat = model.featPositions[id]\n  if (feat) {\n    const { f } = feat\n    model.setClickId(f.id())\n    const session = getSession(model)\n    if (isSessionModelWithWidgets(session)) {\n      session.showWidget(\n        session.addWidget('BaseFeatureWidget', 'baseFeature', {\n          view,\n          track,\n          featureData: f.toJSON(),\n        }),\n      )\n    }\n  }\n  return feat\n}\n\nexport function onSynContextClick(\n  event: React.MouseEvent,\n  model: LinearSyntenyDisplayModel,\n  setAnchorEl: (arg: ClickCoord) => void,\n) {\n  event.preventDefault()\n  const ref1 = model.clickMapCanvas\n  const ref2 = model.cigarClickMapCanvas\n  if (!ref1 || !ref2) {\n    return\n  }\n  const rect = ref1.getBoundingClientRect()\n  const ctx1 = ref1.getContext('2d')\n  const ctx2 = ref2.getContext('2d')\n  if (!ctx1 || !ctx2) {\n    return\n  }\n  const { clientX, clientY } = event\n  const x = clientX - rect.left\n  const y = clientY - rect.top\n  const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data\n  const unitMultiplier = Math.floor(MAX_COLOR_RANGE / model.numFeats)\n  const id = getId(r1!, g1!, b1!, unitMultiplier)\n  const f = model.featPositions[id]\n  if (f) {\n    model.setClickId(f.f.id())\n    setAnchorEl({ clientX, clientY, feature: f })\n  }\n}\n\nexport function getTooltip(f: Feature, cigarOp?: string, cigarOpLen?: string) {\n  // @ts-expect-error\n  const f1 = f.toJSON() as {\n    refName: string\n    start: number\n    end: number\n    strand?: number\n    assemblyName: string\n    identity?: number\n    name?: string\n    mate: {\n      start: number\n      end: number\n      refName: string\n      name: string\n    }\n  }\n  const f2 = f1.mate\n  const l1 = f1.end - f1.start\n  const l2 = f2.end - f2.start\n  const identity = f1.identity\n  const n1 = f1.name\n  const n2 = f2.name\n  return [\n    `Loc1: ${assembleLocString(f1)}`,\n    `Loc2: ${assembleLocString(f2)}`,\n    `Inverted: ${f1.strand === -1}`,\n    `Query len: ${l1.toLocaleString('en-US')}`,\n    `Target len: ${l2.toLocaleString('en-US')}`,\n    identity ? `Identity: ${identity.toPrecision(2)}` : '',\n    cigarOp ? `CIGAR operator: ${cigarOp}${cigarOpLen}` : '',\n    n1 ? `Name 1: ${n1}` : '',\n    n2 ? `Name 1: ${n2}` : '',\n  ]\n    .filter(f => !!f)\n    .join('<br/>')\n}\n","import { doesIntersect2, getContainingView } from '@jbrowse/core/util'\n// locals\nimport { LinearSyntenyViewModel } from '../LinearSyntenyView/model'\nimport { LinearSyntenyDisplayModel } from './model'\nimport { draw, drawMatchSimple } from './components/util'\n\nexport const MAX_COLOR_RANGE = 255 * 255 * 255 // max color range\n\nfunction makeColor(idx: number) {\n  const r = Math.floor(idx / (255 * 255)) % 255\n  const g = Math.floor(idx / 255) % 255\n  const b = idx % 255\n  return `rgb(${r},${g},${b})`\n}\n\nconst colorMap = {\n  I: '#ff03',\n  N: '#0a03',\n  D: '#00f3',\n  X: 'brown',\n  M: '#f003',\n  '=': '#f003',\n}\n\nconst lineLimit = 3\n\nconst oobLimit = 1600\n\nexport function getId(r: number, g: number, b: number, unitMultiplier: number) {\n  return Math.floor((r * 255 * 255 + g * 255 + b - 1) / unitMultiplier)\n}\n\nexport function drawRef(\n  model: LinearSyntenyDisplayModel,\n  ctx1: CanvasRenderingContext2D,\n  ctx3?: CanvasRenderingContext2D,\n) {\n  const view = getContainingView(model) as LinearSyntenyViewModel\n  const drawCurves = view.drawCurves\n  const drawCIGAR = view.drawCIGAR\n  const height = view.middleComparativeHeight\n  const width = view.width\n  const bpPerPxs = view.views.map(v => v.bpPerPx)\n\n  if (ctx3) {\n    ctx3.imageSmoothingEnabled = false\n  }\n\n  ctx1.beginPath()\n  const featPos = model.featPositions\n  const offsets = view.views.map(v => v.offsetPx)\n\n  const unitMultiplier = Math.floor(MAX_COLOR_RANGE / featPos.length)\n\n  // this loop is optimized to draw many thin lines with a single ctx.stroke\n  // call, a separate loop below draws larger boxes\n  ctx1.fillStyle = colorMap.M\n  ctx1.strokeStyle = colorMap.M\n  for (const { p11, p12, p21, p22 } of featPos) {\n    const x11 = p11.offsetPx - offsets[0]!\n    const x12 = p12.offsetPx - offsets[0]!\n    const x21 = p21.offsetPx - offsets[1]!\n    const x22 = p22.offsetPx - offsets[1]!\n    const l1 = Math.abs(x12 - x11)\n    const l2 = Math.abs(x22 - x21)\n    const y1 = 0\n    const y2 = height\n    const mid = (y2 - y1) / 2\n\n    // drawing a line if the results are thin results in much less pixellation\n    // than filling in a thin polygon\n    if (\n      l1 <= lineLimit &&\n      l2 <= lineLimit &&\n      x21 < width + oobLimit &&\n      x21 > -oobLimit\n    ) {\n      ctx1.moveTo(x11, y1)\n      if (drawCurves) {\n        ctx1.bezierCurveTo(x11, mid, x21, mid, x21, y2)\n      } else {\n        ctx1.lineTo(x21, y2)\n      }\n    }\n  }\n  ctx1.stroke()\n\n  // this loop only draws small lines as a polyline, the polyline calls\n  // ctx.stroke once is much more efficient than calling stroke() many times\n  ctx1.fillStyle = colorMap.M\n  ctx1.strokeStyle = colorMap.M\n  for (const { p11, p12, p21, p22, f, cigar } of featPos) {\n    const x11 = p11.offsetPx - offsets[0]!\n    const x12 = p12.offsetPx - offsets[0]!\n    const x21 = p21.offsetPx - offsets[1]!\n    const x22 = p22.offsetPx - offsets[1]!\n    const l1 = Math.abs(x12 - x11)\n    const l2 = Math.abs(x22 - x21)\n    const minX = Math.min(x21, x22)\n    const maxX = Math.max(x21, x22)\n    const y1 = 0\n    const y2 = height\n    const mid = (y2 - y1) / 2\n\n    if (\n      !(l1 <= lineLimit && l2 <= lineLimit) &&\n      doesIntersect2(minX, maxX, -oobLimit, view.width + oobLimit)\n    ) {\n      const s1 = f.get('strand')\n      const k1 = s1 === -1 ? x12 : x11\n      const k2 = s1 === -1 ? x11 : x12\n\n      // rev1/rev2 flip the direction of the CIGAR drawing in horizontally flipped\n      // modes. somewhat heuristically determined, but tested for\n      const rev1 = k1 < k2 ? 1 : -1\n      const rev2 = (x21 < x22 ? 1 : -1) * s1\n\n      // cx1/cx2 are the current x positions on top and bottom rows\n      let cx1 = k1\n      let cx2 = s1 === -1 ? x22 : x21\n      if (cigar.length && drawCIGAR) {\n        // continuingFlag skips drawing commands on very small CIGAR features\n        let continuingFlag = false\n\n        // px1/px2 are the previous x positions on the top and bottom rows\n        let px1 = 0\n        let px2 = 0\n        const unitMultiplier2 = Math.floor(MAX_COLOR_RANGE / cigar.length)\n        for (let j = 0; j < cigar.length; j += 2) {\n          const idx = j * unitMultiplier2 + 1\n\n          const len = +cigar[j]!\n          const op = cigar[j + 1] as keyof typeof colorMap\n\n          if (!continuingFlag) {\n            px1 = cx1\n            px2 = cx2\n          }\n\n          const d1 = len / bpPerPxs[0]!\n          const d2 = len / bpPerPxs[1]!\n\n          if (op === 'M' || op === '=' || op === 'X') {\n            cx1 += d1 * rev1\n            cx2 += d2 * rev2\n          } else if (op === 'D' || op === 'N') {\n            cx1 += d1 * rev1\n          }\n          // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n          else if (op === 'I') {\n            cx2 += d2 * rev2\n          }\n\n          // check that we are even drawing in view here, e.g. that all\n          // points are not all less than 0 or greater than width\n          if (\n            !(\n              Math.max(px1, px2, cx1, cx2) < 0 ||\n              Math.min(px1, px2, cx1, cx2) > width\n            )\n          ) {\n            // if it is a small feature and not the last element of the\n            // CIGAR (which could skip rendering it entire if we did turn\n            // it on), then turn on continuing flag\n            const isNotLast = j < cigar.length - 2\n            if (\n              Math.abs(cx1 - px1) <= 1 &&\n              Math.abs(cx2 - px2) <= 1 &&\n              isNotLast\n            ) {\n              continuingFlag = true\n            } else {\n              // allow rendering the dominant color when using continuing flag\n              // if the last element of continuing was a large feature, else\n              // just use match\n              ctx1.fillStyle =\n                colorMap[(continuingFlag && d1 > 1) || d2 > 1 ? op : 'M']\n              continuingFlag = false\n\n              draw(ctx1, px1, cx1, y1, cx2, px2, y2, mid, drawCurves)\n              if (ctx3) {\n                ctx3.fillStyle = makeColor(idx)\n                draw(ctx3, px1, cx1, y1, cx2, px2, y2, mid, drawCurves)\n              }\n            }\n          }\n        }\n      } else {\n        draw(ctx1, x11, x12, y1, x22, x21, y2, mid, drawCurves)\n      }\n    }\n  }\n\n  // draw click map\n  const ctx2 = model.clickMapCanvas?.getContext('2d')\n  if (!ctx2) {\n    return\n  }\n  ctx2.imageSmoothingEnabled = false\n  ctx2.clearRect(0, 0, width, height)\n  for (let i = 0; i < featPos.length; i++) {\n    const feature = featPos[i]!\n    const idx = i * unitMultiplier + 1\n    ctx2.fillStyle = makeColor(idx)\n\n    // too many click map false positives with colored stroked lines\n    drawMatchSimple({\n      cb: ctx => {\n        ctx.fill()\n      },\n      feature,\n      ctx: ctx2,\n      drawCurves,\n      offsets,\n      oobLimit,\n      viewWidth: view.width,\n      hideTiny: true,\n      height,\n    })\n  }\n  return undefined\n}\n\nexport function drawMouseoverSynteny(model: LinearSyntenyDisplayModel) {\n  const { clickId, mouseoverId } = model\n  const highResolutionScaling = 1\n  const view = getContainingView(model) as LinearSyntenyViewModel\n  const drawCurves = view.drawCurves\n  const height = view.middleComparativeHeight\n  const width = view.width\n  const ctx = model.mouseoverCanvas?.getContext('2d')\n  const offsets = view.views.map(v => v.offsetPx)\n\n  if (!ctx) {\n    return\n  }\n  ctx.resetTransform()\n  ctx.scale(highResolutionScaling, highResolutionScaling)\n  ctx.clearRect(0, 0, width, height)\n  const feature1 = model.featMap[mouseoverId || '']\n  if (feature1) {\n    ctx.fillStyle = 'rgb(0,0,0,0.1)'\n    drawMatchSimple({\n      cb: ctx => {\n        ctx.fill()\n      },\n      feature: feature1,\n      ctx,\n      oobLimit,\n      viewWidth: view.width,\n      drawCurves,\n      offsets,\n      height,\n    })\n  }\n  const feature2 = model.featMap[clickId || '']\n  if (feature2) {\n    ctx.strokeStyle = 'rgb(0, 0, 0, 0.9)'\n\n    drawMatchSimple({\n      cb: ctx => {\n        ctx.stroke()\n      },\n      feature: feature2,\n      ctx,\n      oobLimit,\n      viewWidth: view.width,\n      drawCurves,\n      offsets,\n      height,\n    })\n  }\n}\n"],"names":["doAfterAttach","self","addDisposer","autorun","view","getContainingView","initialized","ctx1","mainCanvas","getContext","ctx3","cigarClickMapCanvas","height","middleComparativeHeight","width","clearRect","drawRef","drawMouseoverSynteny","reaction","bpPerPx","views","map","v","displayedRegions","JSON","stringify","features","assemblyManager","getSession","viewSnaps","getSnapshot","staticBlocks","interRegionPaddingWidth","minimumBlockWidth","feats","f","mate","get","f1s","f1e","f2s","start","f2e","end","a1","a2","assemblyName","r1","r2","refName","ref1","getCanonicalRefName","ref2","v1","v2","p11","bpToPx","coord","p12","p21","p22","undefined","cigar","push","MismatchParser","setFeatPositions","fireImmediately","drawMatchSimple","feature","ctx","offsets","cb","drawCurves","oobLimit","viewWidth","hideTiny","x11","offsetPx","x12","x21","x22","l1","Math","abs","l2","y2","mid","minX","min","maxX","max","doesIntersect2","beginPath","moveTo","bezierCurveTo","lineTo","stroke","draw","x1","x2","y1","x3","x4","len1","len2","tmp","closePath","fill","drawBezierBox","drawBox","onSynClick","event","model","track","getContainingTrack","clickMapCanvas","rect","getBoundingClientRect","ctx2","x","clientX","left","y","clientY","top","g1","b1","getImageData","data","unitMultiplier","floor","MAX_COLOR_RANGE","numFeats","id","getId","feat","featPositions","setClickId","session","isSessionModelWithWidgets","showWidget","addWidget","featureData","toJSON","onSynContextClick","setAnchorEl","preventDefault","getTooltip","cigarOp","cigarOpLen","f1","f2","identity","n1","name","n2","assembleLocString","strand","toLocaleString","toPrecision","filter","join","makeColor","idx","colorMap","I","N","D","X","M","lineLimit","r","g","b","drawCIGAR","bpPerPxs","imageSmoothingEnabled","featPos","length","fillStyle","strokeStyle","s1","k1","rev1","rev2","cx1","cx2","continuingFlag","px1","px2","unitMultiplier2","j","len","op","d1","d2","isNotLast","i","clickId","mouseoverId","mouseoverCanvas","resetTransform","scale","feature1","featMap","feature2"],"sourceRoot":""}