Add log for createLinearGradient
This commit is contained in:
parent
19a377a9e5
commit
fad4284ed5
@ -10,6 +10,7 @@ import { getAppTheme } from '@/state/configsSelectors';
|
||||
import { ROW_HEIGHT, ROW_PADDING_RIGHT, type RowData } from '@/views/Orderbook/OrderbookRow';
|
||||
|
||||
import { MustBigNumber } from '@/lib/numbers';
|
||||
import { log } from '@/lib/telemetry';
|
||||
|
||||
export const useDrawOrderbookHistograms = ({
|
||||
data,
|
||||
@ -107,15 +108,29 @@ export const useDrawOrderbookHistograms = ({
|
||||
const barWidth = value ? (value / histogramRange) * histogramBarWidth : 0;
|
||||
const { gradient, bar } = getXYValues({ barWidth, canvasWidth, gradientMultiplier });
|
||||
|
||||
const linearGradient = ctx.createLinearGradient(
|
||||
gradient.x1,
|
||||
ROW_HEIGHT / 2,
|
||||
gradient.x2,
|
||||
ROW_HEIGHT / 2
|
||||
);
|
||||
linearGradient.addColorStop(0, histogramAccentColor);
|
||||
linearGradient.addColorStop(1, 'rgba(0, 0, 0, 0)');
|
||||
ctx.fillStyle = linearGradient;
|
||||
let linearGradient;
|
||||
|
||||
try {
|
||||
linearGradient = ctx.createLinearGradient(
|
||||
gradient.x1,
|
||||
ROW_HEIGHT / 2,
|
||||
gradient.x2,
|
||||
ROW_HEIGHT / 2
|
||||
);
|
||||
|
||||
linearGradient.addColorStop(0, histogramAccentColor);
|
||||
linearGradient.addColorStop(1, 'rgba(0, 0, 0, 0)');
|
||||
ctx.fillStyle = linearGradient;
|
||||
} catch (err) {
|
||||
log('Orderbook/createLinearGradient', err, {
|
||||
x1: gradient.x1,
|
||||
y1: ROW_HEIGHT / 2,
|
||||
x2: gradient.x2,
|
||||
y2: ROW_HEIGHT / 2,
|
||||
});
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 0, 0, 0)';
|
||||
}
|
||||
|
||||
ctx.beginPath();
|
||||
|
||||
|
||||
@ -74,7 +74,9 @@ export const Orderbook = ({
|
||||
if (asksSlice.length < numRows) {
|
||||
const emptyRows = new Array(numRows - asksSlice.length).fill(getEmptyRow('ask'));
|
||||
asksSlice.push(...emptyRows);
|
||||
} else if (bidsSlice.length < numRows) {
|
||||
}
|
||||
|
||||
if (bidsSlice.length < numRows) {
|
||||
const emptyRows = new Array(numRows - bidsSlice.length).fill(getEmptyRow('bid'));
|
||||
bidsSlice.unshift(...emptyRows);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user