Correction du défilement à la souris (pointeur)

This commit is contained in:
Mattéo Delabre 2016-04-28 10:32:54 +02:00
parent 7d46367eb5
commit dd54596cb7
1 changed files with 21 additions and 10 deletions

View File

@ -277,18 +277,29 @@ void Editor::frame() {
sf::Vector2i mouse = sf::Mouse::getPosition(window); sf::Vector2i mouse = sf::Mouse::getPosition(window);
// détection du dépassement sur un des 4 bords // détection du dépassement sur un des 4 bords
if (mouse.x < POINTER_SCROLL_PADDING && mouse.x >= -POINTER_SCROLL_PADDING) { if (mouse.x >= -POINTER_SCROLL_PADDING &&
mouse.x < window_size.x + POINTER_SCROLL_PADDING &&
mouse.y >= -POINTER_SCROLL_PADDING &&
mouse.y < window_size.y + POINTER_SCROLL_PADDING) {
if (mouse.x < POINTER_SCROLL_PADDING) {
cur_center.x -= POINTER_SCROLL_SPEED; cur_center.x -= POINTER_SCROLL_SPEED;
} else if (mouse.x >= window_size.x - POINTER_SCROLL_PADDING && mouse.x < window_size.x + POINTER_SCROLL_PADDING) { }
if (mouse.x >= window_size.x - POINTER_SCROLL_PADDING) {
cur_center.x += POINTER_SCROLL_SPEED; cur_center.x += POINTER_SCROLL_SPEED;
} else if (mouse.y < POINTER_SCROLL_PADDING && mouse.y >= -POINTER_SCROLL_PADDING) { }
if (mouse.y < POINTER_SCROLL_PADDING) {
cur_center.y -= POINTER_SCROLL_SPEED; cur_center.y -= POINTER_SCROLL_SPEED;
} else if (mouse.y >= window_size.y - POINTER_SCROLL_PADDING && mouse.y < window_size.y + POINTER_SCROLL_PADDING) { }
if (mouse.y >= window_size.y - POINTER_SCROLL_PADDING) {
cur_center.y += POINTER_SCROLL_SPEED; cur_center.y += POINTER_SCROLL_SPEED;
} }
setCenterGoal(cur_center); setCenterGoal(cur_center);
} }
}
// màj du titre de la fenêtre // màj du titre de la fenêtre
getManager().setTitle(sf::String(L"Édition de ") + getName()); getManager().setTitle(sf::String(L"Édition de ") + getName());