Insert Library items in the middle of the screen (#2527)
Co-authored-by: Zen Tang <zen@wayve.ai>
This commit is contained in:
parent
94fe1ff6e6
commit
802b8c50d5
@ -351,6 +351,9 @@ class App extends React.Component<ExcalidrawProps, AppState> {
|
|||||||
const canvasWidth = canvasDOMWidth * canvasScale;
|
const canvasWidth = canvasDOMWidth * canvasScale;
|
||||||
const canvasHeight = canvasDOMHeight * canvasScale;
|
const canvasHeight = canvasDOMHeight * canvasScale;
|
||||||
|
|
||||||
|
const DEFAULT_PASTE_X = canvasDOMWidth / 2;
|
||||||
|
const DEFAULT_PASTE_Y = canvasDOMHeight / 2;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="excalidraw"
|
className="excalidraw"
|
||||||
@ -371,7 +374,11 @@ class App extends React.Component<ExcalidrawProps, AppState> {
|
|||||||
onCollabButtonClick={onCollabButtonClick}
|
onCollabButtonClick={onCollabButtonClick}
|
||||||
onLockToggle={this.toggleLock}
|
onLockToggle={this.toggleLock}
|
||||||
onInsertShape={(elements) =>
|
onInsertShape={(elements) =>
|
||||||
this.addElementsFromPasteOrLibrary(elements)
|
this.addElementsFromPasteOrLibrary(
|
||||||
|
elements,
|
||||||
|
DEFAULT_PASTE_X,
|
||||||
|
DEFAULT_PASTE_Y,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
zenModeEnabled={zenModeEnabled}
|
zenModeEnabled={zenModeEnabled}
|
||||||
toggleZenMode={this.toggleZenMode}
|
toggleZenMode={this.toggleZenMode}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user