mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
make opts optional and use 100% zoom when inserting to canvas
This commit is contained in:
parent
d203794f70
commit
acd6db5304
2 changed files with 16 additions and 9 deletions
|
@ -392,8 +392,8 @@ class ElementStore {
|
|||
|
||||
export const convertToExcalidrawElements = (
|
||||
elements: ExcalidrawElementSkeleton[] | null,
|
||||
appState: AppState,
|
||||
{ regenerateIds = false, transformViewportToSceneCoords = false },
|
||||
appState?: AppState,
|
||||
opts?: { regenerateIds: boolean; transformViewportToSceneCoords: boolean },
|
||||
) => {
|
||||
if (!elements) {
|
||||
return [];
|
||||
|
@ -407,12 +407,12 @@ export const convertToExcalidrawElements = (
|
|||
for (const element of elements) {
|
||||
let excalidrawElement: ExcalidrawElement;
|
||||
const originalId = element.id;
|
||||
if (regenerateIds) {
|
||||
if (opts?.regenerateIds) {
|
||||
Object.assign(element, { id: nanoid() });
|
||||
}
|
||||
|
||||
// transform viewport coords to scene coordinates
|
||||
if (transformViewportToSceneCoords) {
|
||||
if (opts?.transformViewportToSceneCoords && appState) {
|
||||
const { x, y } = viewportCoordsToSceneCoords(
|
||||
{
|
||||
clientX: element.x,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue