bool color_picker::mouse_move( const point &p ) { if ( _tracking ) { point d = p.delta( center() ); coord_type h = std::atan2( d.y(), d.x() ); _current.set_hsl( h, 1.0, 0.5 ); invalidate(); return true; } return widget::mouse_move( p ); }
bool color_picker::mouse_press( const point &p, int b ) { if ( b == 1 ) { coord_type r = point::distance( p, center() ) / radius(); if ( r > 0.70 && r < 0.95 ) { _tracking = true; point d = p.delta( center() ); coord_type h = std::atan2( d.y(), d.x() ); _current.set_hsl( h, 1.0, 0.5 ); return mouse_move( p ); } } return widget::mouse_press( p, b ); }