Просмотр исходного кода

Merge pull request #224 from bigjko/scrollfixes

Caret scroll fix for Return key
Ivan Safrin 12 лет назад
Родитель
Сommit
0f23fbeb40
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      Modules/Contents/UI/Source/PolyUITextInput.cpp

+ 3 - 0
Modules/Contents/UI/Source/PolyUITextInput.cpp

@@ -1279,6 +1279,9 @@ void UITextInput::onKeyDown(PolyKEY key, wchar_t charCode) {
 			}			
 			}			
 			insertLine(true);
 			insertLine(true);
 			updateCaretPosition();
 			updateCaretPosition();
+            if(linesContainer->getPosition().y + (lineOffset*(lineHeight+lineSpacing)+padding) > scrollContainer->getHeight()-lineHeight-lineSpacing) {
+                scrollContainer->setScrollValue(0.0, (((((lineOffset) * ((lineHeight+lineSpacing)))) + padding-(scrollContainer->getHeight()-lineHeight-lineSpacing))/(scrollContainer->getContentSize().y-scrollContainer->getHeight())));
+            }
 		} else {
 		} else {
 			dispatchEvent(new Event(), Event::COMPLETE_EVENT);
 			dispatchEvent(new Event(), Event::COMPLETE_EVENT);
 		}
 		}