This commit is contained in:
Pahul Gogna 2025-04-13 21:53:27 +05:30 committed by GitHub
commit 5f4910e608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -598,6 +598,7 @@ let isDraggingScrollBar: boolean = false;
let currentScrollBars: ScrollBars = { horizontal: null, vertical: null };
let touchTimeout = 0;
let invalidateContextMenu = false;
let elementStartedMoving = false;
/**
* Map of youtube embed video states
@ -8338,6 +8339,30 @@ class App extends React.Component<AppProps, AppState> {
!this.state.editingTextElement &&
this.state.activeEmbeddable?.state !== "active"
) {
if(!this.state.editingLinearElement && !this.state.editingFrame && !this.state.resizingElement){
// this determines the threshold for dragging the element initially
const MOVEMENT_BUFFER = 4;
// this calculates the buffer for the movement based on the zoom level
const ZOOM_RELETIVE_MOVEMENT_BUFFER: number = MOVEMENT_BUFFER / this.state.zoom.value;
console.log(ZOOM_RELETIVE_MOVEMENT_BUFFER); // TODO: remove
if (
!elementStartedMoving && pointDistance(
pointFrom(pointerCoords.x, pointerCoords.y),
pointFrom(pointerDownState.origin.x, pointerDownState.origin.y),
) < ZOOM_RELETIVE_MOVEMENT_BUFFER
) {
return;
}
// sets the elementStartedMoving to true so that the buffer is only used once
elementStartedMoving = true;
}
const dragOffset = {
x: pointerCoords.x - pointerDownState.origin.x,
y: pointerCoords.y - pointerDownState.origin.y,
@ -8862,6 +8887,9 @@ class App extends React.Component<AppProps, AppState> {
isCropping,
} = this.state;
// sets the elementStartedMoving to false so that the buffer can be used again
elementStartedMoving = false;
this.setState((prevState) => ({
isResizing: false,
isRotating: false,