未验证 提交 e75b1cc0 编写于 作者: O openharmony_ci 提交者: Gitee

!917 rotate事件结束增加判0次数

Merge pull request !917 from 郝烁/master
......@@ -25,10 +25,14 @@ constexpr int16_t ROTATE_INPUT_THRESHOLD = 1;
#else
constexpr int16_t ROTATE_INPUT_THRESHOLD = 10;
#endif
constexpr uint8_t ROTATE_END_ZERO_COUNT = 2;
}
namespace OHOS {
RotateInputDevice::RotateInputDevice() : rotateStart_(false), threshold_(ROTATE_INPUT_THRESHOLD), cachedRotation_(0) {}
RotateInputDevice::RotateInputDevice()
: rotateStart_(false), threshold_(ROTATE_INPUT_THRESHOLD), cachedRotation_(0), zeroCount_(0)
{
}
void RotateInputDevice::DispatchEvent(const DeviceData& data)
{
......@@ -65,9 +69,13 @@ void RotateInputDevice::DispatchEvent(const DeviceData& data)
}
if (data.rotate == 0 && rotateStart_) {
view->OnRotateEndEvent(0);
rotateStart_ = false;
GRAPHIC_LOGW("RotateInputDevice dispatched 0-value event!\n");
zeroCount_++;
if (zeroCount_ >= ROTATE_END_ZERO_COUNT) {
view->OnRotateEndEvent(0);
zeroCount_ = 0;
rotateStart_ = false;
GRAPHIC_LOGW("RotateInputDevice dispatched 0-value event!\n");
}
return;
}
if (!rotateStart_) {
......
......@@ -39,6 +39,7 @@ protected:
bool rotateStart_;
int16_t threshold_;
int16_t cachedRotation_;
uint8_t zeroCount_;
};
} // namespace OHOS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册