Browse Source

grid: isActive -> enabeld

merge-requests/4/head
vargburz 3 years ago
parent
commit
ee9e6f51a8
  1. 11
      src/components/grid.ts
  2. 4
      src/types.ts

11
src/components/grid.ts

@ -7,13 +7,13 @@ import * as d3 from 'd3';
import defaultsDeep from 'lodash/defaultsDeep'; import defaultsDeep from 'lodash/defaultsDeep';
const DEFAULT_GRID_TICK_COUNT = 5; const DEFAULT_GRID_TICK_COUNT = 5;
const DEFAULT_GRID_OPTIONS = { const DEFAULT_GRID_OPTIONS: GridOptions = {
x: { x: {
isActive: true, enabled: true,
ticksCount: DEFAULT_GRID_TICK_COUNT, ticksCount: DEFAULT_GRID_TICK_COUNT,
}, },
y: { y: {
isActive: true, enabled: true,
ticksCount: DEFAULT_GRID_TICK_COUNT, 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) // 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 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. // 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. // 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. // We have a general problem with passing d3 as argument everywhere. Fix it, and remove from arg in constructor here.
export class Grid { export class Grid {
@ -50,7 +51,7 @@ export class Grid {
} }
renderGridLinesX(): void { renderGridLinesX(): void {
if(!this.gridOptions.x.isActive) { if(!this.gridOptions.x.enabled) {
return; return;
} }
this._svgEl this._svgEl
@ -67,7 +68,7 @@ export class Grid {
} }
renderGridLinesY(): void { renderGridLinesY(): void {
if(!this.gridOptions.y.isActive) { if(!this.gridOptions.y.enabled) {
return; return;
} }
this._svgEl this._svgEl

4
src/types.ts

@ -86,11 +86,11 @@ export type Options = {
}; };
export type GridOptions = { export type GridOptions = {
x?: { x?: {
isActive?: boolean; enabled?: boolean;
ticksCount?: number; ticksCount?: number;
}, },
y?: { y?: {
isActive?: boolean; enabled?: boolean;
ticksCount?: number; ticksCount?: number;
}, },
} }

Loading…
Cancel
Save