mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: image support (#4011)
Co-authored-by: Emil Atanasov <heitara@gmail.com> Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
parent
0f0244224d
commit
163ad1f4c4
85 changed files with 3536 additions and 618 deletions
|
@ -2,7 +2,7 @@ import { RoughCanvas } from "roughjs/bin/canvas";
|
|||
import { RoughSVG } from "roughjs/bin/svg";
|
||||
import oc from "open-color";
|
||||
|
||||
import { AppState, Zoom } from "../types";
|
||||
import { AppState, BinaryFiles, Zoom } from "../types";
|
||||
import {
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
|
@ -181,7 +181,7 @@ export const renderScene = (
|
|||
rc: RoughCanvas,
|
||||
canvas: HTMLCanvasElement,
|
||||
sceneState: SceneState,
|
||||
// extra options, currently passed by export helper
|
||||
// extra options passed to the renderer
|
||||
{
|
||||
renderScrollbars = true,
|
||||
renderSelection = true,
|
||||
|
@ -190,11 +190,15 @@ export const renderScene = (
|
|||
// doesn't guarantee pixel-perfect output.
|
||||
renderOptimizations = false,
|
||||
renderGrid = true,
|
||||
/** when exporting the behavior is slightly different (e.g. we can't use
|
||||
CSS filters) */
|
||||
isExport = false,
|
||||
}: {
|
||||
renderScrollbars?: boolean;
|
||||
renderSelection?: boolean;
|
||||
renderOptimizations?: boolean;
|
||||
renderGrid?: boolean;
|
||||
isExport?: boolean;
|
||||
} = {},
|
||||
) => {
|
||||
if (canvas === null) {
|
||||
|
@ -211,7 +215,7 @@ export const renderScene = (
|
|||
const normalizedCanvasWidth = canvas.width / scale;
|
||||
const normalizedCanvasHeight = canvas.height / scale;
|
||||
|
||||
if (sceneState.exportWithDarkMode) {
|
||||
if (isExport && sceneState.theme === "dark") {
|
||||
context.filter = THEME_FILTER;
|
||||
}
|
||||
|
||||
|
@ -805,6 +809,7 @@ export const renderSceneToSvg = (
|
|||
elements: readonly NonDeletedExcalidrawElement[],
|
||||
rsvg: RoughSVG,
|
||||
svgRoot: SVGElement,
|
||||
files: BinaryFiles,
|
||||
{
|
||||
offsetX = 0,
|
||||
offsetY = 0,
|
||||
|
@ -824,6 +829,7 @@ export const renderSceneToSvg = (
|
|||
element,
|
||||
rsvg,
|
||||
svgRoot,
|
||||
files,
|
||||
element.x + offsetX,
|
||||
element.y + offsetY,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue