Browse Source

new updateCursor prototype

Odilitime 5 years ago
parent
commit
47315c217f
  1. 16
      src/graphics/components/DocumentComponent.cpp

16
src/graphics/components/DocumentComponent.cpp

@ -171,6 +171,7 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f @@ -171,6 +171,7 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
lineData = getLine(focusedInputComponent->value, 1);
std::cout << "line 1 is " << focusedInputComponent->value.substr(lineData.first, lineData.second) << " start: " << lineData.first << " end: " << lineData.second << std::endl;
*/
/*
if (focusedInputComponent->multiLine) {
//std::pair<int, int> lineData = getLine(focusedInputComponent->value, 0);
focusedInputComponent->cursorCharY--;
@ -181,8 +182,10 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f @@ -181,8 +182,10 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
} else {
focusedInputComponent->cursorCharX = 0;
}
focusedInputComponent->updateCursor();
*/
focusedInputComponent->updateCursor(0, -1);
} else if (key == GLFW_KEY_DOWN) {
/*
if (focusedInputComponent->multiLine) {
//std::pair<int, int> lineData = getLine(focusedInputComponent->value, 0);
focusedInputComponent->cursorCharY++;
@ -194,8 +197,10 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f @@ -194,8 +197,10 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
} else {
focusedInputComponent->cursorCharX = static_cast<size_t>(focusedInputComponent->getValue().size());
}
focusedInputComponent->updateCursor();
*/
focusedInputComponent->updateCursor(0, 1);
} else if (key == GLFW_KEY_LEFT) {
/*
focusedInputComponent->cursorCharX--;
if (focusedInputComponent->cursorCharX < 0) {
if (focusedInputComponent->multiLine) {
@ -211,8 +216,10 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f @@ -211,8 +216,10 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
}
focusedInputComponent->cursorCharX = 0;
}
focusedInputComponent->updateCursor();
*/
focusedInputComponent->updateCursor(-1, 0);
} else if (key == GLFW_KEY_RIGHT) {
/*
focusedInputComponent->cursorCharX++;
if (focusedInputComponent->cursorCharX > focusedInputComponent->getValue().size()) {
if (focusedInputComponent->multiLine) {
@ -227,7 +234,8 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f @@ -227,7 +234,8 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
focusedInputComponent->cursorCharX = focusedInputComponent->getValue().size();
}
}
focusedInputComponent->updateCursor();
*/
focusedInputComponent->updateCursor(1, 0);
} else if (key == GLFW_KEY_ENTER) {
//std::cout << "DocumentComponent::onKeyUp - enter!" << std::endl;
if (focusedInputComponent->multiLine) {

Loading…
Cancel
Save