Hold space to temporary switch to pan tool
This commit is contained in:
parent
658799610b
commit
d52fe2ded2
5 changed files with 24 additions and 6 deletions
|
|
@ -265,15 +265,28 @@ void DrawingProgram::update() {
|
|||
unorderedObjectsExistTimePoint = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
||||
if(drawTool->get_type() == DrawingProgramToolType::BRUSH && world.main.input.pen.isEraser && !temporaryEraser) {
|
||||
switch_to_tool(DrawingProgramToolType::ERASER);
|
||||
if(world.main.input.pen.isEraser && !temporaryEraser) {
|
||||
if(drawTool->get_type() == DrawingProgramToolType::BRUSH)
|
||||
switch_to_tool(DrawingProgramToolType::ERASER);
|
||||
temporaryEraser = true;
|
||||
}
|
||||
else if(drawTool->get_type() == DrawingProgramToolType::ERASER && !world.main.input.pen.isEraser && temporaryEraser) {
|
||||
switch_to_tool(DrawingProgramToolType::BRUSH);
|
||||
else if(!world.main.input.pen.isEraser && temporaryEraser) {
|
||||
if(drawTool->get_type() == DrawingProgramToolType::ERASER)
|
||||
switch_to_tool(DrawingProgramToolType::BRUSH);
|
||||
temporaryEraser = false;
|
||||
}
|
||||
|
||||
if(world.main.input.key(InputManager::KEY_HOLD_TO_PAN).held && !temporaryPan) {
|
||||
toolTypeAfterTempPan = drawTool->get_type();
|
||||
switch_to_tool(DrawingProgramToolType::PAN);
|
||||
temporaryPan = true;
|
||||
}
|
||||
|
||||
if(!world.main.input.key(InputManager::KEY_HOLD_TO_PAN).held && temporaryPan) {
|
||||
switch_to_tool(toolTypeAfterTempPan);
|
||||
temporaryPan = false;
|
||||
}
|
||||
|
||||
controls.cursorHoveringOverCanvas = !world.main.toolbar.io->hoverObstructed;
|
||||
controls.leftClick = controls.cursorHoveringOverCanvas && world.main.input.mouse.leftClicks;
|
||||
if(controls.leftClick) {
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ class DrawingProgram {
|
|||
DrawingProgramSelection selection;
|
||||
|
||||
bool temporaryEraser = false;
|
||||
bool temporaryPan = false;
|
||||
DrawingProgramToolType toolTypeAfterTempPan;
|
||||
|
||||
struct GlobalControls {
|
||||
float relativeWidth = 15.0f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue