Compare commits
1 Commits
dwelle/sta
...
master
Author | SHA1 | Date | |
---|---|---|---|
5639bb8e87 |
@ -1,5 +1,5 @@
|
|||||||
VITE_APP_BACKEND_V2_GET_URL=https://json.excalidraw.com/api/v2/
|
VITE_APP_BACKEND_V2_GET_URL=https://ex.dylanbanta.com/api/v2/scenes/
|
||||||
VITE_APP_BACKEND_V2_POST_URL=https://json.excalidraw.com/api/v2/post/
|
VITE_APP_BACKEND_V2_POST_URL=https://ex.dylanbanta.com/api/v2/scenes/
|
||||||
|
|
||||||
VITE_APP_LIBRARY_URL=https://libraries.excalidraw.com
|
VITE_APP_LIBRARY_URL=https://libraries.excalidraw.com
|
||||||
VITE_APP_LIBRARY_BACKEND=https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries
|
VITE_APP_LIBRARY_BACKEND=https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries
|
||||||
|
@ -19,7 +19,7 @@ services:
|
|||||||
- ./:/opt/node_app/app:delegated
|
- ./:/opt/node_app/app:delegated
|
||||||
- ./package.json:/opt/node_app/package.json
|
- ./package.json:/opt/node_app/package.json
|
||||||
- ./yarn.lock:/opt/node_app/yarn.lock
|
- ./yarn.lock:/opt/node_app/yarn.lock
|
||||||
- notused:/opt/node_app/app/node_modules
|
# - notused:/opt/node_app/app/node_modules
|
||||||
|
|
||||||
volumes:
|
# volumes:
|
||||||
notused:
|
# notused:
|
||||||
|
@ -926,16 +926,21 @@ const ExcalidrawWrapper = () => {
|
|||||||
<ShareDialog
|
<ShareDialog
|
||||||
collabAPI={collabAPI}
|
collabAPI={collabAPI}
|
||||||
onExportToBackend={async () => {
|
onExportToBackend={async () => {
|
||||||
if (excalidrawAPI) {
|
if (!excalidrawAPI) {
|
||||||
try {
|
return;
|
||||||
await onExportToBackend(
|
}
|
||||||
excalidrawAPI.getSceneElements(),
|
try {
|
||||||
excalidrawAPI.getAppState(),
|
const { url, errorMessage } = await exportToBackend(
|
||||||
excalidrawAPI.getFiles(),
|
excalidrawAPI.getSceneElements(),
|
||||||
);
|
excalidrawAPI.getAppState(),
|
||||||
} catch (error: any) {
|
excalidrawAPI.getFiles(),
|
||||||
setErrorMessage(error.message);
|
);
|
||||||
|
if (errorMessage) {
|
||||||
|
throw new Error(errorMessage);
|
||||||
}
|
}
|
||||||
|
setLatestShareableLink(url);
|
||||||
|
} catch (error: any) {
|
||||||
|
setErrorMessage(error.message);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -41,8 +41,8 @@
|
|||||||
"prettier": "@excalidraw/prettier-config",
|
"prettier": "@excalidraw/prettier-config",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build-node": "node ./scripts/build-node.js",
|
"build-node": "node ./scripts/build-node.js",
|
||||||
"build:app:docker": "cross-env VITE_APP_DISABLE_SENTRY=true vite build",
|
"build:app:docker": "vite build",
|
||||||
"build:app": "cross-env VITE_APP_GIT_SHA=$VERCEL_GIT_COMMIT_SHA cross-env VITE_APP_ENABLE_TRACKING=true vite build",
|
"build:app": "vite build",
|
||||||
"build:version": "node ../scripts/build-version.js",
|
"build:version": "node ../scripts/build-version.js",
|
||||||
"build": "yarn build:app && yarn build:version",
|
"build": "yarn build:app && yarn build:version",
|
||||||
"start": "yarn && vite",
|
"start": "yarn && vite",
|
||||||
|
@ -39,7 +39,6 @@ const handleDimensionChange: DragInputCallbackType<
|
|||||||
shouldKeepAspectRatio,
|
shouldKeepAspectRatio,
|
||||||
shouldChangeByStepSize,
|
shouldChangeByStepSize,
|
||||||
nextValue,
|
nextValue,
|
||||||
ratio,
|
|
||||||
property,
|
property,
|
||||||
originalAppState,
|
originalAppState,
|
||||||
instantChange,
|
instantChange,
|
||||||
@ -155,12 +154,6 @@ const handleDimensionChange: DragInputCallbackType<
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nextValue !== undefined) {
|
if (nextValue !== undefined) {
|
||||||
if (ratio) {
|
|
||||||
ratio = property === "width" ? ratio : [ratio[1], ratio[0]];
|
|
||||||
nextValue = (origElement[property] / ratio[0]) * ratio[1];
|
|
||||||
property = property === "width" ? "height" : "width";
|
|
||||||
}
|
|
||||||
|
|
||||||
const nextWidth = Math.max(
|
const nextWidth = Math.max(
|
||||||
property === "width"
|
property === "width"
|
||||||
? nextValue
|
? nextValue
|
||||||
|
@ -33,7 +33,6 @@ export type DragInputCallbackType<
|
|||||||
shouldChangeByStepSize: boolean;
|
shouldChangeByStepSize: boolean;
|
||||||
scene: Scene;
|
scene: Scene;
|
||||||
nextValue?: number;
|
nextValue?: number;
|
||||||
ratio?: [number, number] | null;
|
|
||||||
property: P;
|
property: P;
|
||||||
originalAppState: AppState;
|
originalAppState: AppState;
|
||||||
setInputValue: (value: number) => void;
|
setInputValue: (value: number) => void;
|
||||||
@ -110,21 +109,10 @@ const StatsDragInput = <
|
|||||||
}
|
}
|
||||||
stateRef.current.updatePending = false;
|
stateRef.current.updatePending = false;
|
||||||
|
|
||||||
const ratioMatch = updatedValue
|
|
||||||
.trim()
|
|
||||||
.match(/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/);
|
|
||||||
|
|
||||||
let ratio: [number, number] | null = null;
|
|
||||||
if (ratioMatch) {
|
|
||||||
ratio = [Number(ratioMatch[1]), Number(ratioMatch[2])];
|
|
||||||
}
|
|
||||||
|
|
||||||
const parsed = Number(updatedValue);
|
const parsed = Number(updatedValue);
|
||||||
if (isNaN(parsed)) {
|
if (isNaN(parsed)) {
|
||||||
setInputValue(value.toString());
|
setInputValue(value.toString());
|
||||||
if (!ratio) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const rounded = Number(parsed.toFixed(2));
|
const rounded = Number(parsed.toFixed(2));
|
||||||
@ -135,11 +123,7 @@ const StatsDragInput = <
|
|||||||
// 2. original was not "Mixed" and the difference between a new value and previous value is greater
|
// 2. original was not "Mixed" and the difference between a new value and previous value is greater
|
||||||
// than the smallest delta allowed, which is 0.01
|
// than the smallest delta allowed, which is 0.01
|
||||||
// reason: idempotent to avoid unnecessary
|
// reason: idempotent to avoid unnecessary
|
||||||
if (
|
if (isNaN(original) || Math.abs(rounded - original) >= SMALLEST_DELTA) {
|
||||||
isNaN(original) ||
|
|
||||||
ratio ||
|
|
||||||
Math.abs(rounded - original) >= SMALLEST_DELTA
|
|
||||||
) {
|
|
||||||
stateRef.current.lastUpdatedValue = updatedValue;
|
stateRef.current.lastUpdatedValue = updatedValue;
|
||||||
dragInputCallback({
|
dragInputCallback({
|
||||||
accumulatedChange: 0,
|
accumulatedChange: 0,
|
||||||
@ -150,7 +134,6 @@ const StatsDragInput = <
|
|||||||
shouldChangeByStepSize: false,
|
shouldChangeByStepSize: false,
|
||||||
scene,
|
scene,
|
||||||
nextValue: rounded,
|
nextValue: rounded,
|
||||||
ratio,
|
|
||||||
property,
|
property,
|
||||||
originalAppState: appState,
|
originalAppState: appState,
|
||||||
setInputValue: (value) => setInputValue(String(value)),
|
setInputValue: (value) => setInputValue(String(value)),
|
||||||
|
@ -151,7 +151,6 @@ const handleDimensionChange: DragInputCallbackType<
|
|||||||
originalAppState,
|
originalAppState,
|
||||||
shouldChangeByStepSize,
|
shouldChangeByStepSize,
|
||||||
nextValue,
|
nextValue,
|
||||||
ratio,
|
|
||||||
scene,
|
scene,
|
||||||
property,
|
property,
|
||||||
}) => {
|
}) => {
|
||||||
@ -203,22 +202,9 @@ const handleDimensionChange: DragInputCallbackType<
|
|||||||
origElement &&
|
origElement &&
|
||||||
isPropertyEditable(latestElement, property)
|
isPropertyEditable(latestElement, property)
|
||||||
) {
|
) {
|
||||||
let _nextValue = nextValue;
|
|
||||||
let _property = property;
|
|
||||||
if (ratio) {
|
|
||||||
let _ratio = ratio;
|
|
||||||
if (ratio) {
|
|
||||||
_ratio = _property === "width" ? _ratio : [_ratio[1], _ratio[0]];
|
|
||||||
_nextValue = (origElement[_property] / _ratio[0]) * _ratio[1];
|
|
||||||
_property = _property === "width" ? "height" : "width";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let nextWidth =
|
let nextWidth =
|
||||||
_property === "width"
|
property === "width" ? Math.max(0, nextValue) : latestElement.width;
|
||||||
? Math.max(0, _nextValue)
|
if (property === "width") {
|
||||||
: latestElement.width;
|
|
||||||
if (_property === "width") {
|
|
||||||
if (shouldChangeByStepSize) {
|
if (shouldChangeByStepSize) {
|
||||||
nextWidth = getStepSizedValue(nextWidth, STEP_SIZE);
|
nextWidth = getStepSizedValue(nextWidth, STEP_SIZE);
|
||||||
} else {
|
} else {
|
||||||
@ -227,10 +213,10 @@ const handleDimensionChange: DragInputCallbackType<
|
|||||||
}
|
}
|
||||||
|
|
||||||
let nextHeight =
|
let nextHeight =
|
||||||
_property === "height"
|
property === "height"
|
||||||
? Math.max(0, _nextValue)
|
? Math.max(0, nextValue)
|
||||||
: latestElement.height;
|
: latestElement.height;
|
||||||
if (_property === "height") {
|
if (property === "height") {
|
||||||
if (shouldChangeByStepSize) {
|
if (shouldChangeByStepSize) {
|
||||||
nextHeight = getStepSizedValue(nextHeight, STEP_SIZE);
|
nextHeight = getStepSizedValue(nextHeight, STEP_SIZE);
|
||||||
} else {
|
} else {
|
||||||
@ -248,7 +234,7 @@ const handleDimensionChange: DragInputCallbackType<
|
|||||||
origElement,
|
origElement,
|
||||||
originalElementsMap,
|
originalElementsMap,
|
||||||
scene,
|
scene,
|
||||||
_property === "width" ? "e" : "s",
|
property === "width" ? "e" : "s",
|
||||||
{
|
{
|
||||||
shouldInformMutation: false,
|
shouldInformMutation: false,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user