mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: support decreasing/increasing fontSize
via keyboard (#4553)
Co-authored-by: david <dw@dw.local>
This commit is contained in:
parent
4501d6d630
commit
a51ed9ced6
10 changed files with 214 additions and 93 deletions
|
@ -21,9 +21,8 @@ import { AppState } from "../types";
|
|||
import { getElementAbsoluteCoords } from ".";
|
||||
import { adjustXYWithRotation } from "../math";
|
||||
import { getResizedElementAbsoluteCoords } from "./bounds";
|
||||
import { measureText } from "./textElement";
|
||||
import { getContainerElement, measureText } from "./textElement";
|
||||
import { isBoundToContainer } from "./typeChecks";
|
||||
import Scene from "../scene/Scene";
|
||||
import { BOUND_TEXT_PADDING } from "../constants";
|
||||
|
||||
type ElementConstructorOpts = MarkOptional<
|
||||
|
@ -159,8 +158,8 @@ const getAdjustedDimensions = (
|
|||
baseline: number;
|
||||
} => {
|
||||
let maxWidth = null;
|
||||
if (element.containerId) {
|
||||
const container = Scene.getScene(element)!.getElement(element.containerId)!;
|
||||
const container = getContainerElement(element);
|
||||
if (container) {
|
||||
maxWidth = container.width - BOUND_TEXT_PADDING * 2;
|
||||
}
|
||||
const {
|
||||
|
@ -220,7 +219,7 @@ const getAdjustedDimensions = (
|
|||
// make sure container dimensions are set properly when
|
||||
// text editor overflows beyond viewport dimensions
|
||||
if (isBoundToContainer(element)) {
|
||||
const container = Scene.getScene(element)!.getElement(element.containerId)!;
|
||||
const container = getContainerElement(element)!;
|
||||
let height = container.height;
|
||||
let width = container.width;
|
||||
if (nextHeight > height - BOUND_TEXT_PADDING * 2) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue