fix: freedraw slow movement jittery lines (#4726)
Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
parent
98ea46664c
commit
96de887cc8
@ -3852,14 +3852,20 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
const dx = pointerCoords.x - draggingElement.x;
|
const dx = pointerCoords.x - draggingElement.x;
|
||||||
const dy = pointerCoords.y - draggingElement.y;
|
const dy = pointerCoords.y - draggingElement.y;
|
||||||
|
|
||||||
const pressures = draggingElement.simulatePressure
|
const lastPoint = points.length > 0 && points[points.length - 1];
|
||||||
? draggingElement.pressures
|
const discardPoint =
|
||||||
: [...draggingElement.pressures, event.pressure];
|
lastPoint && lastPoint[0] === dx && lastPoint[1] === dy;
|
||||||
|
|
||||||
mutateElement(draggingElement, {
|
if (!discardPoint) {
|
||||||
points: [...points, [dx, dy]],
|
const pressures = draggingElement.simulatePressure
|
||||||
pressures,
|
? draggingElement.pressures
|
||||||
});
|
: [...draggingElement.pressures, event.pressure];
|
||||||
|
|
||||||
|
mutateElement(draggingElement, {
|
||||||
|
points: [...points, [dx, dy]],
|
||||||
|
pressures,
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (isLinearElement(draggingElement)) {
|
} else if (isLinearElement(draggingElement)) {
|
||||||
pointerDownState.drag.hasOccurred = true;
|
pointerDownState.drag.hasOccurred = true;
|
||||||
const points = draggingElement.points;
|
const points = draggingElement.points;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user