From ee9e6f51a8b03641d5753bb70ed4ee95cb48fb59 Mon Sep 17 00:00:00 2001 From: vargburz Date: Fri, 29 Oct 2021 16:00:38 +0300 Subject: [PATCH] grid: isActive -> enabeld --- src/components/grid.ts | 11 ++++++----- src/types.ts | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/grid.ts b/src/components/grid.ts index 424602e..2b097d8 100644 --- a/src/components/grid.ts +++ b/src/components/grid.ts @@ -7,13 +7,13 @@ import * as d3 from 'd3'; import defaultsDeep from 'lodash/defaultsDeep'; const DEFAULT_GRID_TICK_COUNT = 5; -const DEFAULT_GRID_OPTIONS = { +const DEFAULT_GRID_OPTIONS: GridOptions = { x: { - isActive: true, + enabled: true, ticksCount: DEFAULT_GRID_TICK_COUNT, }, y: { - isActive: true, + enabled: true, ticksCount: DEFAULT_GRID_TICK_COUNT, }, } @@ -22,6 +22,7 @@ const DEFAULT_GRID_OPTIONS = { // Grid Class - is a core component, which can be a separate Pod in the future. (but not in current Pod terminology) // All components have construcor with required args: svg element which will be filled with this component and options for it. // All compoтents have a reqiured method "render", which will be called in core costructor. <- this solution is temporary. +// Each component has its own default options. // svgElement should be a separate class with its own height, width, xScale, yScale params to avoid SvgElOptions as argument. // We have a general problem with passing d3 as argument everywhere. Fix it, and remove from arg in constructor here. export class Grid { @@ -50,7 +51,7 @@ export class Grid { } renderGridLinesX(): void { - if(!this.gridOptions.x.isActive) { + if(!this.gridOptions.x.enabled) { return; } this._svgEl @@ -67,7 +68,7 @@ export class Grid { } renderGridLinesY(): void { - if(!this.gridOptions.y.isActive) { + if(!this.gridOptions.y.enabled) { return; } this._svgEl diff --git a/src/types.ts b/src/types.ts index a082abb..249fa7d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -86,11 +86,11 @@ export type Options = { }; export type GridOptions = { x?: { - isActive?: boolean; + enabled?: boolean; ticksCount?: number; }, y?: { - isActive?: boolean; + enabled?: boolean; ticksCount?: number; }, }