Files
excalidraw/packages/excalidraw/actions/actionIncreaseFontSize.ts
2024-01-30 13:08:53 +05:30

22 lines
666 B
TypeScript

import { KEYS } from "../keys";
import { register } from "./register";
import { changeFontSize, FONT_SIZE_RELATIVE_INCREASE_STEP } from "./utils";
export const actionIncreaseFontSize = register({
name: "increaseFontSize",
trackEvent: false,
perform: (elements, appState, value, app) => {
return changeFontSize(elements, appState, app, (element) =>
Math.round(element.fontSize * (1 + FONT_SIZE_RELATIVE_INCREASE_STEP)),
);
},
keyTest: (event) => {
return (
event[KEYS.CTRL_OR_CMD] &&
event.shiftKey &&
// KEYS.PERIOD needed for MacOS
(event.key === KEYS.CHEVRON_RIGHT || event.key === KEYS.PERIOD)
);
},
});