do not center text when not applicable (#1783)

This commit is contained in:
David Luzar 2020-06-25 21:21:27 +02:00 committed by GitHub
parent 9c89504b6f
commit cd87bd6901
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 418 additions and 321 deletions

View file

@ -2,6 +2,7 @@ import { ExcalidrawElement } from "./element/types";
import { newElement, newTextElement } from "./element";
import { AppState } from "./types";
import { t } from "./i18n";
import { DEFAULT_VERTICAL_ALIGN } from "./constants";
interface Spreadsheet {
yAxisLabel: string | null;
@ -167,6 +168,7 @@ export function renderSpreadsheet(
fontSize: 16,
fontFamily: appState.currentItemFontFamily,
textAlign: appState.currentItemTextAlign,
verticalAlign: DEFAULT_VERTICAL_ALIGN,
});
const maxYLabel = newTextElement({
@ -183,6 +185,7 @@ export function renderSpreadsheet(
fontSize: 16,
fontFamily: appState.currentItemFontFamily,
textAlign: appState.currentItemTextAlign,
verticalAlign: DEFAULT_VERTICAL_ALIGN,
});
const bars = spreadsheet.values.map((value, i) => {
@ -226,6 +229,7 @@ export function renderSpreadsheet(
fontSize: 16,
fontFamily: appState.currentItemFontFamily,
textAlign: "center",
verticalAlign: DEFAULT_VERTICAL_ALIGN,
width: BAR_WIDTH,
angle: ANGLE,
});
@ -246,6 +250,7 @@ export function renderSpreadsheet(
fontSize: 20,
fontFamily: appState.currentItemFontFamily,
textAlign: "center",
verticalAlign: DEFAULT_VERTICAL_ALIGN,
width: BAR_WIDTH,
angle: ANGLE,
})