Skip to content

Commit

Permalink
chore: rename VerticalAlignment to VerticalAlignments
Browse files Browse the repository at this point in the history
  • Loading branch information
monfera committed Apr 29, 2020
1 parent af0c010 commit 9c30090
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Font } from './types';
import { config, ValueGetterName } from '../config/config';
import { ArrayNode, HierarchyOfArrays } from '../utils/group_by_rollup';
import { Color } from '../../../../utils/commons';
import { VerticalAlignment } from '../viewmodel/viewmodel';
import { VerticalAlignments } from '../viewmodel/viewmodel';

export type LinkLabelVM = {
link: [PointTuple, ...PointTuple[]]; // at least one point
Expand Down Expand Up @@ -65,7 +65,7 @@ export interface RowSet {
fillTextColor: string;
fontSize: number;
rotation: Radian;
verticalAlignment: VerticalAlignment;
verticalAlignment: VerticalAlignments;
leftAlign: boolean; // might be generalized into horizontalAlign - if needed
container?: any;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { Layer } from '../../specs/index';
import { stringToRGB } from '../utils/d3_utils';
import { colorIsDark } from '../utils/calcs';
import { ValueFormatter } from '../../../../utils/commons';
import { RectangleConstruction, VerticalAlignment, VerticalAlignments } from './viewmodel';
import { RectangleConstruction, VerticalAlignments } from './viewmodel';

const INFINITY_RADIUS = 1e4; // far enough for a sub-2px precision on a 4k screen, good enough for text bounds; 64 bit floats still work well with it

Expand Down Expand Up @@ -174,7 +174,7 @@ export function getSectorRowGeometry(

function getVerticalAlignment(
container: RectangleConstruction,
verticalAlignment: VerticalAlignment,
verticalAlignment: VerticalAlignments,
linePitch: Pixels,
totalRowCount: number,
rowIndex: number,
Expand Down Expand Up @@ -202,7 +202,7 @@ export function getRectangleRowGeometry(
rowIndex: number,
fontSize: Pixels,
_rotation: Radian,
verticalAlignment: VerticalAlignment,
verticalAlignment: VerticalAlignments,
): RowSpace {
const overhang = 0.05;
const padding = fontSize < 6 ? 0 : Math.max(1, Math.min(2, fontSize / 16)); // taper out padding with small fonts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const VerticalAlignments = Object.freeze({
// we might add more in the future; also, the intent is to still be of CanvasTextBaseline
type SupportedVerticalAlignments = $Values<typeof VerticalAlignments>;

export type VerticalAlignment = CanvasTextBaseline & SupportedVerticalAlignments;
export type VerticalAlignments = CanvasTextBaseline & SupportedVerticalAlignments;

function rectangleFillOrigins(n: ShapeTreeNode): [Pixels, Pixels] {
return [(n.x0 + n.x1) / 2, (n.y0 + n.y1) / 2];
Expand Down

0 comments on commit 9c30090

Please sign in to comment.