mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): hold shift w/ brush to draw straight line
This commit is contained in:
parent
091e2fb751
commit
f083be9391
@ -187,36 +187,60 @@ export const setStageEventHandlers = ({
|
|||||||
setLastMouseDownPos(pos);
|
setLastMouseDownPos(pos);
|
||||||
|
|
||||||
if (toolState.selected === 'brush') {
|
if (toolState.selected === 'brush') {
|
||||||
onBrushLineAdded(
|
if (e.evt.shiftKey) {
|
||||||
{
|
// Extend the last line straight to the new point
|
||||||
id: selectedEntity.id,
|
setLastAddedPoint(pos);
|
||||||
points: [
|
onPointAddedToLine(
|
||||||
pos.x - selectedEntity.x,
|
{
|
||||||
pos.y - selectedEntity.y,
|
id: selectedEntity.id,
|
||||||
pos.x - selectedEntity.x,
|
point: [pos.x - selectedEntity.x, pos.y - selectedEntity.y],
|
||||||
pos.y - selectedEntity.y,
|
},
|
||||||
],
|
selectedEntity.type
|
||||||
color: getCurrentFill(),
|
);
|
||||||
width: toolState.brush.width,
|
} else {
|
||||||
},
|
onBrushLineAdded(
|
||||||
selectedEntity.type
|
{
|
||||||
);
|
id: selectedEntity.id,
|
||||||
|
points: [
|
||||||
|
pos.x - selectedEntity.x,
|
||||||
|
pos.y - selectedEntity.y,
|
||||||
|
pos.x - selectedEntity.x,
|
||||||
|
pos.y - selectedEntity.y,
|
||||||
|
],
|
||||||
|
color: getCurrentFill(),
|
||||||
|
width: toolState.brush.width,
|
||||||
|
},
|
||||||
|
selectedEntity.type
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toolState.selected === 'eraser') {
|
if (toolState.selected === 'eraser') {
|
||||||
onEraserLineAdded(
|
if (e.evt.shiftKey) {
|
||||||
{
|
// Extend the last line straight to the new point
|
||||||
id: selectedEntity.id,
|
setLastAddedPoint(pos);
|
||||||
points: [
|
onPointAddedToLine(
|
||||||
pos.x - selectedEntity.x,
|
{
|
||||||
pos.y - selectedEntity.y,
|
id: selectedEntity.id,
|
||||||
pos.x - selectedEntity.x,
|
point: [pos.x - selectedEntity.x, pos.y - selectedEntity.y],
|
||||||
pos.y - selectedEntity.y,
|
},
|
||||||
],
|
selectedEntity.type
|
||||||
width: toolState.eraser.width,
|
);
|
||||||
},
|
} else {
|
||||||
selectedEntity.type
|
onEraserLineAdded(
|
||||||
);
|
{
|
||||||
|
id: selectedEntity.id,
|
||||||
|
points: [
|
||||||
|
pos.x - selectedEntity.x,
|
||||||
|
pos.y - selectedEntity.y,
|
||||||
|
pos.x - selectedEntity.x,
|
||||||
|
pos.y - selectedEntity.y,
|
||||||
|
],
|
||||||
|
width: toolState.eraser.width,
|
||||||
|
},
|
||||||
|
selectedEntity.type
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user