Skip to content

Commit

Permalink
Merge pull request #75 from devexperts/fix/zoom-constraint-right-x-is…
Browse files Browse the repository at this point in the history
…-incorrect

fix: changed the logic of zoom constraint when the xStart and xEnd doesn't fit the constraint
  • Loading branch information
DeltaZN authored Nov 13, 2023
2 parents c333355 + 2993a0f commit 194bd61
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/chart/model/scaling/constrait.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const candleEdgesConstrait = (
* @doc-tags viewport,zoom,scaling
*/
export const zoomConstraint = (
initialState: ViewportModelState,
_: ViewportModelState,
state: ViewportModelState,
chartConfig: ChartConfigComponentsChart,
boundsProvider: BoundsProvider,
Expand All @@ -79,7 +79,6 @@ export const zoomConstraint = (
}

if (minViewportReached) {
newState.xEnd = initialState.xEnd;
newState.xStart = newState.xEnd - chartConfig.minCandles;
newState.zoomX = calculateZoom(newState.xEnd - newState.xStart, bounds.width);
return newState;
Expand Down

0 comments on commit 194bd61

Please sign in to comment.