remove debug and provide value for stylus

This commit is contained in:
Ryan Di
2025-06-16 17:19:55 +10:00
parent 37b75263f8
commit c72c47f0cd
7 changed files with 53 additions and 112 deletions

View File

@ -11,6 +11,11 @@ import type { ExcalidrawFreeDrawElement } from "./types";
export const DRAWING_CONFIGS = {
default: {
streamline: 0.25,
simplify: 0.25,
},
// for optimal performance, we use a lower streamline and simplify
stylus: {
streamline: 0.1,
simplify: 0.1,
},
} as const;

View File

@ -7594,11 +7594,9 @@ class App extends React.Component<AppProps, AppState> {
simulatePressure,
drawingConfigs: {
pressureSensitivity: this.state.currentItemPressureSensitivity,
streamline:
window.h?.debugFreedraw?.streamline ??
DRAWING_CONFIGS.default.streamline,
simplify:
window.h?.debugFreedraw?.simplify ?? DRAWING_CONFIGS.default.simplify,
...(event.pointerType === "pen"
? DRAWING_CONFIGS.stylus
: DRAWING_CONFIGS.default),
},
locked: false,
frameId: topLayerFrame ? topLayerFrame.id : null,
@ -11382,10 +11380,6 @@ declare global {
app: InstanceType<typeof App>;
history: History;
store: Store;
debugFreedraw?: {
streamline: number;
simplify: number;
};
};
}
}
@ -11394,9 +11388,6 @@ export const createTestHook = () => {
if (isTestEnv() || isDevEnv()) {
window.h = window.h || ({} as Window["h"]);
// Initialize debug freedraw parameters
window.h.debugFreedraw = window.h.debugFreedraw || DRAWING_CONFIGS.default;
Object.defineProperties(window.h, {
elements: {
configurable: true,

View File

@ -8910,6 +8910,11 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte
"backgroundColor": "transparent",
"boundElements": null,
"customData": undefined,
"drawingConfigs": {
"pressureSensitivity": 1,
"simplify": "0.25000",
"streamline": "0.25000",
},
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
@ -8942,7 +8947,6 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte
50,
],
],
"pressureSensitivity": 1,
"pressures": [],
"roughness": 1,
"roundness": null,
@ -9015,6 +9019,11 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte
"backgroundColor": "transparent",
"boundElements": null,
"customData": undefined,
"drawingConfigs": {
"pressureSensitivity": 1,
"simplify": "0.25000",
"streamline": "0.25000",
},
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
@ -9046,7 +9055,6 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte
50,
],
],
"pressureSensitivity": 1,
"pressures": [],
"roughness": 1,
"roundness": null,
@ -12064,6 +12072,11 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f
"backgroundColor": "transparent",
"boundElements": null,
"customData": undefined,
"drawingConfigs": {
"pressureSensitivity": 1,
"simplify": "0.25000",
"streamline": "0.25000",
},
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
@ -12092,7 +12105,6 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f
10,
],
],
"pressureSensitivity": 1,
"pressures": [],
"roughness": 1,
"roundness": null,
@ -12115,6 +12127,11 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f
"backgroundColor": "transparent",
"boundElements": null,
"customData": undefined,
"drawingConfigs": {
"pressureSensitivity": 1,
"simplify": "0.25000",
"streamline": "0.25000",
},
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
@ -12143,7 +12160,6 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f
10,
],
],
"pressureSensitivity": 1,
"pressures": [],
"roughness": 1,
"roundness": null,
@ -12256,6 +12272,11 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f
"backgroundColor": "transparent",
"boundElements": null,
"customData": undefined,
"drawingConfigs": {
"pressureSensitivity": 1,
"simplify": "0.25000",
"streamline": "0.25000",
},
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
@ -12283,7 +12304,6 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f
10,
],
],
"pressureSensitivity": 1,
"pressures": [],
"roughness": 1,
"roundness": null,

View File

@ -6877,6 +6877,11 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack
"backgroundColor": "transparent",
"boundElements": null,
"customData": undefined,
"drawingConfigs": {
"pressureSensitivity": 1,
"simplify": "0.25000",
"streamline": "0.25000",
},
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
@ -6904,7 +6909,6 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack
10,
],
],
"pressureSensitivity": 1,
"pressures": [],
"roughness": 1,
"roundness": null,
@ -9152,6 +9156,11 @@ exports[`regression tests > key 7 selects freedraw tool > [end of test] undo sta
"backgroundColor": "transparent",
"boundElements": null,
"customData": undefined,
"drawingConfigs": {
"pressureSensitivity": 1,
"simplify": "0.25000",
"streamline": "0.25000",
},
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
@ -9179,7 +9188,6 @@ exports[`regression tests > key 7 selects freedraw tool > [end of test] undo sta
10,
],
],
"pressureSensitivity": 1,
"pressures": [],
"roughness": 1,
"roundness": null,
@ -10156,6 +10164,11 @@ exports[`regression tests > key p selects freedraw tool > [end of test] undo sta
"backgroundColor": "transparent",
"boundElements": null,
"customData": undefined,
"drawingConfigs": {
"pressureSensitivity": 1,
"simplify": "0.25000",
"streamline": "0.25000",
},
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
@ -10183,7 +10196,6 @@ exports[`regression tests > key p selects freedraw tool > [end of test] undo sta
10,
],
],
"pressureSensitivity": 1,
"pressures": [],
"roughness": 1,
"roundness": null,

View File

@ -170,6 +170,11 @@ exports[`restoreElements > should restore freedraw element correctly 1`] = `
"backgroundColor": "transparent",
"boundElements": [],
"customData": undefined,
"drawingConfigs": {
"pressureSensitivity": 1,
"simplify": "0.10000",
"streamline": "0.25000",
},
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
@ -191,7 +196,6 @@ exports[`restoreElements > should restore freedraw element correctly 1`] = `
10,
],
],
"pressureSensitivity": 1,
"pressures": [],
"roughness": 1,
"roundness": {