feat: Rounding coordinates

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs
2026-06-22 14:39:39 +02:00
parent 28a9b1711d
commit 435b4a1684
15 changed files with 537 additions and 522 deletions
+2 -1
View File
@@ -11,6 +11,7 @@
*/
import { clearAppStateForLocalStorage } from "@excalidraw/excalidraw/appState";
import { stringifyWithPrecision } from "@excalidraw/excalidraw/data/json";
import {
CANVAS_SEARCH_TAB,
DEFAULT_SIDEBAR,
@@ -89,7 +90,7 @@ const saveDataStateToLocalStorage = (
localStorage.setItem(
STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS,
JSON.stringify(getNonDeletedElements(elements)),
stringifyWithPrecision(getNonDeletedElements(elements)),
);
localStorage.setItem(
STORAGE_KEYS.LOCAL_STORAGE_APP_STATE,
+2 -1
View File
@@ -1,6 +1,7 @@
import { reconcileElements } from "@excalidraw/excalidraw";
import { MIME_TYPES, toBrandedType } from "@excalidraw/common";
import { decompressData } from "@excalidraw/excalidraw/data/encode";
import { stringifyWithPrecision } from "@excalidraw/excalidraw/data/json";
import {
encryptData,
decryptData,
@@ -94,7 +95,7 @@ const encryptElements = async (
key: string,
elements: readonly ExcalidrawElement[],
): Promise<{ ciphertext: ArrayBuffer; iv: Uint8Array }> => {
const json = JSON.stringify(elements);
const json = stringifyWithPrecision(elements);
const encoded = new TextEncoder().encode(json);
const { encryptedBuffer, iv } = await encryptData(key, encoded);