improve content_view for dragging

This commit is contained in:
Jinhao 2017-05-04 05:32:09 +08:00
parent abda8e55ec
commit 74707820bf

View File

@ -92,14 +92,15 @@ namespace nana {
auto mouse_evt = [this](const arg_mouse& arg)
{
if (event_code::mouse_move == arg.evt_code)
if (event_code::mouse_down == arg.evt_code)
{
if (!arg.is_left_button())
return;
if ((!this->drag_started) && this->view.view_area().is_hit(arg.pos))
this->drag_started = true;
this->drag_started = this->view.view_area().is_hit(arg.pos);
}
else if (event_code::mouse_move == arg.evt_code)
{
if (this->drag_started && this->drive(arg.pos))
{
tmr.interval(16);
@ -113,6 +114,7 @@ namespace nana {
}
};
API::events(handle).mouse_down.connect_unignorable(mouse_evt);
API::events(handle).mouse_move.connect_unignorable(mouse_evt);
API::events(handle).mouse_up.connect_unignorable(mouse_evt);