mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): brush spacing handling
This commit is contained in:
parent
c171fe2b96
commit
bee3fa339d
@ -1,9 +1,5 @@
|
|||||||
import { calculateNewBrushSize } from 'features/canvas/hooks/useCanvasZoom';
|
import { calculateNewBrushSize } from 'features/canvas/hooks/useCanvasZoom';
|
||||||
import {
|
import { getIsMouseDown, getScaledFlooredCursorPosition, snapPosToStage } from 'features/controlLayers/konva/util';
|
||||||
getIsMouseDown,
|
|
||||||
getScaledFlooredCursorPosition,
|
|
||||||
snapPosToStage,
|
|
||||||
} from 'features/controlLayers/konva/util';
|
|
||||||
import {
|
import {
|
||||||
type AddBrushLineArg,
|
type AddBrushLineArg,
|
||||||
type AddEraserLineArg,
|
type AddEraserLineArg,
|
||||||
@ -74,9 +70,10 @@ const maybeAddNextPoint = (
|
|||||||
if (lastAddedPoint) {
|
if (lastAddedPoint) {
|
||||||
// Dispatching redux events impacts perf substantially - using brush spacing keeps dispatches to a reasonable number
|
// Dispatching redux events impacts perf substantially - using brush spacing keeps dispatches to a reasonable number
|
||||||
if (Math.hypot(lastAddedPoint.x - currentPos.x, lastAddedPoint.y - currentPos.y) < $brushSpacingPx.get()) {
|
if (Math.hypot(lastAddedPoint.x - currentPos.x, lastAddedPoint.y - currentPos.y) < $brushSpacingPx.get()) {
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$lastAddedPoint.set(currentPos);
|
||||||
onPointAddedToLine({ layerId, point: [currentPos.x, currentPos.y] });
|
onPointAddedToLine({ layerId, point: [currentPos.x, currentPos.y] });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user