| 93 | } |
| 94 | |
| 95 | bool tooltip::ToolTipController::OnPress(event::Event &event) { |
| 96 | if (isTooltips()) { |
| 97 | if (this->toolTips_.size() == 0) { |
| 98 | return false; |
| 99 | } |
| 100 | |
| 101 | util::Point point = event.points[0]; |
| 102 | point.x = fmax(chart_->GetCoord().GetXAxis().x, fmin(chart_->GetCoord().GetXAxis().y, point.x)); |
| 103 | point.y = fmax(chart_->GetCoord().GetYAxis().y, fmin(chart_->GetCoord().GetYAxis().x, point.y)); |
| 104 | |
| 105 | auto currentTime = xg::CurrentTimestampAtMM(); |
| 106 | auto deltaTime = currentTime - lastShowTimeStamp_; |
| 107 | if (deltaTime > 32) { |
| 108 | chart_->GetLogTracer()->trace("%s delta: %lu", "#ToolTipController onPress startShowTooltips", deltaTime); |
| 109 | bool ret = this->ShowToolTips(point); |
| 110 | this->lastShowTimeStamp_ = currentTime; |
| 111 | return ret; |
| 112 | } |
| 113 | } else { |
| 114 | // chart_->GetLogTracer()->trace("%s", "#ToolTipController onPress"); |
| 115 | if(this->toolTip_.get() == nullptr) |
| 116 | return false; |
| 117 | |
| 118 | util::Point point = event.points[0]; |
| 119 | point.x = fmax(chart_->GetCoord().GetXAxis().x, fmin(chart_->GetCoord().GetXAxis().y, point.x)); |
| 120 | point.y = fmax(chart_->GetCoord().GetYAxis().y, fmin(chart_->GetCoord().GetYAxis().x, point.y)); |
| 121 | // bool alwaysShow = config_["alwaysShow"]; |
| 122 | // if(!chart_->coord_->IsContains(point.x, point.y)) { |
| 123 | // chart_->GetLogTracer()->trace("%s", "#ToolTipController onPress interrupted."); |
| 124 | // if(!alwaysShow) { |
| 125 | // return this->HideToolTip(); |
| 126 | // } |
| 127 | // return false; |
| 128 | // } |
| 129 | |
| 130 | auto currentTime = xg::CurrentTimestampAtMM(); |
| 131 | auto deltaTime = currentTime - lastShowTimeStamp_; |
| 132 | if(deltaTime > 32) { |
| 133 | chart_->GetLogTracer()->trace("%s delta: %lu", "#ToolTipController onPress startShowTooltip", deltaTime); |
| 134 | bool ret = this->ShowToolTip(point); |
| 135 | this->lastShowTimeStamp_ = currentTime; |
| 136 | return ret; |
| 137 | } |
| 138 | } |
| 139 | return false; |
| 140 | } |
| 141 | |
| 142 | bool tooltip::ToolTipController::OnPressEnd(event::Event &event) { |
| 143 | chart_->GetLogTracer()->trace("%s", "#ToolTipController onPressend"); |
nothing calls this directly
no test coverage detected