Skip to content

Commit

Permalink
Limit the thickness of spans in the minimap
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
  • Loading branch information
rubenvp8510 committed Apr 17, 2019
1 parent 5f40765 commit db03666
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const MIN_ITEM_HEIGHT = 2;
export const MAX_TOTAL_HEIGHT = 200;
export const MIN_ITEM_WIDTH = 10;
export const MIN_TOTAL_HEIGHT = 60;
const MAX_ITEM_HEIGHT = 6;

export default function renderIntoCanvas(
canvas: HTMLCanvasElement,
Expand All @@ -36,7 +37,9 @@ export default function renderIntoCanvas(
canvas.width = cWidth;
// eslint-disable-next-line no-param-reassign
canvas.height = cHeight;
const itemHeight = Math.max(MIN_ITEM_HEIGHT, cHeight / items.length);
const computedItemHeight = Math.max(MIN_ITEM_HEIGHT, cHeight / items.length);
const itemHeight = computedItemHeight > MAX_ITEM_HEIGHT? MAX_ITEM_HEIGHT : computedItemHeight;

const itemYChange = cHeight / items.length;

const ctx = canvas.getContext('2d', { alpha: false }) as CanvasRenderingContext2D;
Expand Down

0 comments on commit db03666

Please sign in to comment.