Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
force float
Sara Vieira6565b45ce5e9
diff --git a/apps/designer/app/shared/db/assets.server.ts b/apps/designer/app/shared/db/assets.server.tsindex 7b8e02f7dd..5d5405603c 100644--- a/apps/designer/app/shared/db/assets.server.ts+++ b/apps/designer/app/shared/db/assets.server.ts@@ -17,6 +17,10 @@ export const loadByProject = async (projectId?: Project["id"]) => {return assets;};+const forceFloat = (number: number) => {+ return parseFloat(Number(number).toFixed(1));+};+export const create = async (projectId: Project["id"],values: { name: string; path: string; size: number; arrayBuffer: ArrayBuffer }@@ -30,8 +34,8 @@ export const create = async (path: values.path,size: values.size,format: metadata.format,- ...(metadata.width ? { width: Math.round(metadata.width) } : {}),- ...(metadata.height ? { height: Math.round(metadata.height) } : {}),+ ...(metadata.width ? { width: forceFloat(metadata.width) } : {}),+ ...(metadata.height ? { height: forceFloat(metadata.height) } : {}),projectId,},});diff --git a/apps/designer/prisma/migrations/20220717152939_make_width_and_height_float/migration.sql b/apps/designer/prisma/migrations/20220717152939_make_width_and_height_float/migration.sqlnew file mode 100644index 0000000000..ea90ad8d89--- /dev/null+++ b/apps/designer/prisma/migrations/20220717152939_make_width_and_height_float/migration.sql@@ -0,0 +1,3 @@+-- AlterTable+ALTER TABLE "Asset" ALTER COLUMN "height" SET DATA TYPE DOUBLE PRECISION,+ALTER COLUMN "width" SET DATA TYPE DOUBLE PRECISION;diff --git a/apps/designer/prisma/schema.prisma b/apps/designer/prisma/schema.prismaindex daaaac3626..189a414d7b 100644--- a/apps/designer/prisma/schema.prisma+++ b/apps/designer/prisma/schema.prisma@@ -21,8 +21,8 @@ model Asset {projectId Stringformat String?size Int- width Int?- height Int?+ width Float?+ height Float?name Stringpath Stringalt String?