This commit is contained in:
@@ -24,8 +24,13 @@ type ObjectSettingsProps = {
|
||||
onDelete: (id: string) => void;
|
||||
};
|
||||
|
||||
const roundNumbersDeep = <T,>(value: T): T => {
|
||||
const DECIMAL_KEYS = new Set(["lineHeight"]);
|
||||
|
||||
const roundNumbersDeep = <T,>(value: T, parentKey?: string): T => {
|
||||
if (typeof value === "number") {
|
||||
if (parentKey && DECIMAL_KEYS.has(parentKey)) {
|
||||
return value as T;
|
||||
}
|
||||
return Math.round(value) as T;
|
||||
}
|
||||
|
||||
@@ -35,7 +40,7 @@ const roundNumbersDeep = <T,>(value: T): T => {
|
||||
|
||||
if (value && typeof value === "object") {
|
||||
const roundedObject = Object.entries(value).reduce<Record<string, unknown>>((acc, [key, nestedValue]) => {
|
||||
acc[key] = roundNumbersDeep(nestedValue);
|
||||
acc[key] = roundNumbersDeep(nestedValue, key);
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user