bool RequestBall::mouseOver(TextArea& textarea, vec2& mouse) { //within 3 pixels vec2 from_mouse = pos - mouse; if( glm::dot(from_mouse, from_mouse) < 36.0f) { std::vector<std::string> content; content.push_back( std::string( le->path ) ); content.push_back( " " ); if(le->vhost.size()>0) content.push_back( std::string("Virtual-Host: ") + le->vhost ); content.push_back( std::string("Remote-Host: ") + le->hostname ); if(le->referrer.size()>0) content.push_back( std::string("Referrer: ") + le->referrer ); if(le->user_agent.size()>0) content.push_back( std::string("User-Agent: ") + le->user_agent ); textarea.setText(content); textarea.setPos(mouse); textarea.setColour(colour); return true; } return false; }
bool Summarizer::mouseOver(TextArea& textarea, vec2 mouse) { mouseover=false; if(right && mouse.x < pos_x) return false; if(mouse.y < top_gap || mouse.y > (display.height-bottom_gap)) return false; if(items.empty()) return false; float y = mouse.y; for(SummItem& item : items) { if(item.departing) continue; if(item.pos.y<=y && (item.pos.y+font.getMaxHeight()+4) > y) { if(mouse.x< item.pos.x || mouse.x > item.pos.x + item.width) continue; std::vector<std::string> content; textarea.setText(item.unit.expanded); textarea.setColour(vec3(item.colour)); textarea.setPos(mouse); mouseover=true; return true; } } return false; }
bool Paddle::mouseOver(TextArea& textarea, vec2& mouse) { if(pos.x <= mouse.x && pos.x + width >= mouse.x && abs(pos.y - mouse.y) < height/2) { std::vector<std::string> content; content.push_back( token ); textarea.setText(content); textarea.setPos(mouse); textarea.setColour(vec3(colour)); return true; } return false; }