Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(orderbook): update orderbook to not be scrollable #846

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into mulan/ct-997-condense-orderbook-view-to-not-…
…be-scrollable2
  • Loading branch information
moo-onthelawn committed Jul 24, 2024
commit bd4078e32f8dafca07a61d7fd83df3f8ff90a6cf
31 changes: 8 additions & 23 deletions src/hooks/Orderbook/useDrawOrderbook.ts
Original file line number Diff line number Diff line change
@@ -106,28 +106,26 @@ export const useDrawOrderbook = ({

const drawBars = useCallback(
({
barType,
ctx,
depthOrSizeValue,
gradientMultiplier,
value,
gradientMultiplier = GRADIENT_MULTIPLIER,
histogramAccentColor,
histogramSide: inHistogramSide,
rekt,
}: {
barType: 'depth' | 'size';
ctx: CanvasRenderingContext2D;
depthOrSizeValue: number;
gradientMultiplier: number;
value: number;
gradientMultiplier?: number;
histogramAccentColor: string;
histogramSide: 'left' | 'right';
rekt: Rekt;
}) => {
const { x1, x2, y1, y2 } = rekt;

// X values
const maxHistogramBarWidth = x2 - x1 - (barType === 'size' ? 8 : 2);
const barWidth = depthOrSizeValue
? Math.min((depthOrSizeValue / histogramRange) * maxHistogramBarWidth, maxHistogramBarWidth)
const maxHistogramBarWidth = x2 - x1 - 2;
const barWidth = value
? Math.min((value / histogramRange) * maxHistogramBarWidth, maxHistogramBarWidth)
: 0;

const { gradient, bar } = getHistogramXValues({
@@ -320,27 +318,14 @@ export const useDrawOrderbook = ({
// Depth Bar
if (depth) {
drawBars({
barType: 'depth',
ctx,
depthOrSizeValue: depth,
gradientMultiplier: 1.3,
value: depth,
histogramAccentColor,
histogramSide,
rekt,
});
}

// Size Bar
drawBars({
barType: 'size',
ctx,
depthOrSizeValue: size,
gradientMultiplier: 5,
histogramAccentColor,
histogramSide,
rekt,
});

if (mine && mine > 0) {
drawMineCircle({ ctx, rekt });
}
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.