[DEV] add findger single touche move for scrooled widget

This commit is contained in:
Edouard DUPIN 2014-04-18 23:30:45 +02:00
parent 624d28af36
commit 9dd0e26158
5 changed files with 112 additions and 82 deletions

2
build

@ -1 +1 @@
Subproject commit b7cc1ef456bc7635a1eff57f8c3e0919adb6b7a8
Subproject commit 30c25ed15b4eb6b9a51547b0c91509804ad9c2ec

2
external/etk vendored

@ -1 +1 @@
Subproject commit 1bd40ce2d0b684b5d0707414d7809c5f61008a44
Subproject commit 31f670a70b7eac171462abdf318ae251dc946fc1

2
external/ewolsa vendored

@ -1 +1 @@
Subproject commit 0c3219e6f01260c434040cd07050ba9714a5fd45
Subproject commit 143d319c9175d38b5cf009bb228361b67023e452

View File

@ -17,7 +17,8 @@
ewol::widget::WidgetScrolled::WidgetScrolled(const std::string& _shaperName) :
m_shaperH(_shaperName),
m_shaperV(_shaperName) {
m_shaperV(_shaperName),
m_singleFingerMode(true) {
addObjectType("ewol::widget::WidgetScrolled");
m_originScrooled.setValue(0,0);
m_pixelScrolling = 20;
@ -262,6 +263,10 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event
} else if ( _event.getType() == ewol::key::typeFinger
&& ( m_highSpeedType == ewol::key::typeUnknow
|| m_highSpeedType == ewol::key::typeFinger) ) {
if (m_singleFingerMode == false) {
// ***********************
// ** Two finger mode : **
// ***********************
if (_event.getId() >= 3) {
return false;
}
@ -278,7 +283,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event
&& m_fingerPresent[1] == true
&& m_fingerScoolActivated == false) {
m_fingerScoolActivated = true;
EWOL_DEBUG("SCROOL == > START pos=" << m_fingerMoveStartPos);
EWOL_VERBOSE("SCROOL == > START pos=" << m_fingerMoveStartPos);
}
if (m_fingerScoolActivated == true) {
// 1: scroll...
@ -289,7 +294,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event
m_originScrooled.setX(etk_avg(0, m_originScrooled.x(), (m_maxSize.x() - m_size.x()*m_limitScrolling)));
m_originScrooled.setY(etk_avg(0, m_originScrooled.y(), (m_maxSize.y() - m_size.y()*m_limitScrolling)));
m_fingerMoveStartPos[idTable] = relativePos;
EWOL_DEBUG("SCROOL == > MOVE m_originScrooled=" << m_originScrooled << " " << relativePos << " " << m_highSpeedStartPos);
EWOL_VERBOSE("SCROOL == > MOVE m_originScrooled=" << m_originScrooled << " " << relativePos << " " << m_highSpeedStartPos);
markToRedraw();
}
if ( m_fingerPresent[0] == false
@ -302,19 +307,22 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event
}
return true;
}
#if 0 // old mode of first finger move...
} else {
// **************************
// ** Single finger mode : **
// **************************
if (_event.getId() == 1) {
EWOL_VERBOSE("event 1 " << _event);
if (_event.getStatus() == ewol::key::statusDown) {
m_highSpeedMode = ewol::widget::Scroll::speedModeInit;
m_highSpeedType = ewol::key::typeFinger;
m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y());
EWOL_DEBUG("SCROOL == > INIT");
EWOL_VERBOSE("SCROOL == > INIT");
return true;
} else if (_event.getStatus() == ewol::key::statusUpAfter) {
m_highSpeedMode = ewol::widget::Scroll::speedModeDisable;
m_highSpeedType = ewol::key::typeUnknow;
EWOL_DEBUG("SCROOL == > DISABLE");
EWOL_VERBOSE("SCROOL == > DISABLE");
markToRedraw();
return true;
} else if ( m_highSpeedMode == ewol::widget::Scroll::speedModeInit
@ -337,7 +345,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event
m_originScrooled.setX(etk_avg(0, m_originScrooled.x(), (m_maxSize.x() - m_size.x()*m_limitScrolling)));
m_originScrooled.setY(etk_avg(0, m_originScrooled.y(), (m_maxSize.y() - m_size.y()*m_limitScrolling)));
m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y());
EWOL_DEBUG("SCROOL == > MOVE m_originScrooled=" << m_originScrooled << " " << relativePos << " " << m_highSpeedStartPos);
EWOL_VERBOSE("SCROOL == > MOVE m_originScrooled=" << m_originScrooled << " " << relativePos << " " << m_highSpeedStartPos);
markToRedraw();
return true;
}
@ -345,11 +353,11 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event
&& _event.getStatus() == ewol::key::statusLeave) {
m_highSpeedMode = ewol::widget::Scroll::speedModeDisable;
m_highSpeedType = ewol::key::typeUnknow;
EWOL_DEBUG("SCROOL == > DISABLE");
EWOL_VERBOSE("SCROOL == > DISABLE");
markToRedraw();
return true;
}
#endif
}
}
} else if (m_scroollingMode == scroolModeCenter) {
if (_event.getType() == ewol::key::typeMouse) {
@ -462,3 +470,9 @@ void ewol::widget::WidgetScrolled::scroolingMode(enum scrollingMode _newMode) {
}
}
void ewol::widget::WidgetScrolled::setSingleFinger(bool _status) {
if (m_singleFingerMode == _status) {
return;
}
m_singleFingerMode = _status;
}

View File

@ -44,6 +44,22 @@ namespace ewol {
int32_t m_highSpeedButton;
enum ewol::key::type m_highSpeedType;
private: // finger section:
bool m_singleFingerMode; //!< in many case the moving in a subwidget is done with one finger, it is enought ==> the user select...
public:
/**
* @brief Set the single finger capabilities/
* @param[in] _status True if single inger mode, two otherwise/
*/
void setSingleFinger(bool _status);
/**
* @brief Get the single finger capabilities
* @return true The single finger mode is active
* @return false The To finger mode is active
*/
bool getSingleFinger(void) {
return m_singleFingerMode;
}
private:
bool m_fingerPresent[CALCULATE_SIMULTANEOUS_FINGER];
bool m_fingerScoolActivated;
vec2 m_fingerMoveStartPos[CALCULATE_SIMULTANEOUS_FINGER];