Updates to fix BoxSelect when using Orbit with the new Camera (#825)

* update camera controller to block box select during orbit

* simplify update for modern viewport camera controller

* wip working lmb box select with orbit

* add test for changes to click detector

* add unit test for camera system to validate events

* remove debugging code, tidy-up changes for PR

* small updates before posting PR

* fix for linux build failure
This commit is contained in:
Tom Hulton-Harrop
2021-05-20 15:54:36 +01:00
committed by GitHub
parent 0b4b0698c7
commit eb31d90ad9
13 changed files with 269 additions and 70 deletions
@@ -139,4 +139,21 @@ namespace UnitTest
EXPECT_THAT(secondaryDownOutcome, Eq(ClickDetector::ClickOutcome::Nil)); // ignored double click
EXPECT_THAT(secondaryUpOutcome, Eq(ClickDetector::ClickOutcome::Nil)); // click not registered
}
// if the click detector registers a mouse down event, but then all intermediate calls are ignored
// (another system may start intercepting events and swallowing them) then when we do receive a mouse
// up event we should ensure we take into account the current delta - if the delta is large, then the
// outcome will be release
TEST_F(ClickDetectorFixture, ClickIsNotRegisteredAfterIgnoringMouseMovesBeforeMouseUpWithLargeDelta)
{
using ::testing::Eq;
const ClickDetector::ClickOutcome downOutcome =
m_clickDetector.DetectClick(ClickDetector::ClickEvent::Down, ScreenVector(0, 0));
const ClickDetector::ClickOutcome upOutcome =
m_clickDetector.DetectClick(ClickDetector::ClickEvent::Up, ScreenVector(50, 50));
EXPECT_THAT(downOutcome, Eq(ClickDetector::ClickOutcome::Nil));
EXPECT_THAT(upOutcome, Eq(ClickDetector::ClickOutcome::Release));
}
} // namespace UnitTest