mirror of
https://github.com/excalidraw/excalidraw.git
synced 2024-11-02 03:25:53 +01:00
fix: drawing from 0-dimension canvas (#8356)
This commit is contained in:
parent
87a9430809
commit
88014ace4a
@ -199,7 +199,7 @@ const generateElementCanvas = (
|
||||
zoom: Zoom,
|
||||
renderConfig: StaticCanvasRenderConfig,
|
||||
appState: StaticCanvasAppState,
|
||||
): ExcalidrawElementWithCanvas => {
|
||||
): ExcalidrawElementWithCanvas | null => {
|
||||
const canvas = document.createElement("canvas");
|
||||
const context = canvas.getContext("2d")!;
|
||||
const padding = getCanvasPadding(element);
|
||||
@ -210,6 +210,10 @@ const generateElementCanvas = (
|
||||
zoom,
|
||||
);
|
||||
|
||||
if (!width || !height) {
|
||||
return null;
|
||||
}
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
|
||||
@ -540,6 +544,10 @@ const generateElementWithCanvas = (
|
||||
appState,
|
||||
);
|
||||
|
||||
if (!elementWithCanvas) {
|
||||
return null;
|
||||
}
|
||||
|
||||
elementWithCanvasCache.set(element, elementWithCanvas);
|
||||
|
||||
return elementWithCanvas;
|
||||
@ -742,6 +750,10 @@ export const renderElement = (
|
||||
renderConfig,
|
||||
appState,
|
||||
);
|
||||
if (!elementWithCanvas) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawElementFromCanvas(
|
||||
elementWithCanvas,
|
||||
context,
|
||||
@ -881,6 +893,10 @@ export const renderElement = (
|
||||
appState,
|
||||
);
|
||||
|
||||
if (!elementWithCanvas) {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentImageSmoothingStatus = context.imageSmoothingEnabled;
|
||||
|
||||
if (
|
||||
|
Loading…
Reference in New Issue
Block a user