Scroll wheel in native look editor now scrolls window under cursor

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@226 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-03-22 13:07:39 +00:00
parent 2c2bf88a40
commit 1bf5af3de4
2 changed files with 11 additions and 3 deletions
+9 -3
View File
@@ -131,10 +131,16 @@ void NativeLookEditor::onScroll(wxScrollWinEvent& ev) {
}
}
void NativeLookEditor::onMouseWheel(wxMouseEvent& ev) {
if (current_editor) {
bool scrolled = current_editor->onMouseWheel(mousePoint(ev), ev);
if (scrolled) return;
// send scroll event to field under cursor
RealPoint pos = mousePoint(ev);
FOR_EACH_EDITOR_REVERSE { // find high z index fields first
if (v->containsPoint(pos) && v->getField()->editable) {
bool scrolled = e->onMouseWheel(mousePoint(ev), ev);
if (scrolled) return;
break;
}
}
// scroll entire window
int toScroll = 10 * ev.GetWheelRotation() * ev.GetLinesPerAction() / ev.GetWheelDelta(); // note: up is positive
int y = GetScrollPos(wxVERTICAL);
scrollTo(wxVERTICAL, y - toScroll);