Fix scrolling
This commit is contained in:
@@ -493,7 +493,6 @@ int main() {
|
|||||||
if (!window.mouse_selecting_hori_bar && !window.mouse_selecting_vert_bar) {
|
if (!window.mouse_selecting_hori_bar && !window.mouse_selecting_vert_bar) {
|
||||||
bool mouse_in_window = CheckCollisionPointRec(mouse, ToRectangle(window.rect)) ||
|
bool mouse_in_window = CheckCollisionPointRec(mouse, ToRectangle(window.rect)) ||
|
||||||
CheckCollisionPointRec(mouse, ToRectangle(line_number_rect));
|
CheckCollisionPointRec(mouse, ToRectangle(line_number_rect));
|
||||||
// @todo: fix scrolling bug when selecting on left outside the frame!!
|
|
||||||
if (!window.mouse_selecting && mouse_in_window) {
|
if (!window.mouse_selecting && mouse_in_window) {
|
||||||
SetMouseCursor(MOUSE_CURSOR_IBEAM);
|
SetMouseCursor(MOUSE_CURSOR_IBEAM);
|
||||||
}
|
}
|
||||||
@@ -504,9 +503,10 @@ int main() {
|
|||||||
|
|
||||||
if ((mouse_in_window && IsMouseButtonDown(MOUSE_BUTTON_LEFT)) || window.mouse_selecting) {
|
if ((mouse_in_window && IsMouseButtonDown(MOUSE_BUTTON_LEFT)) || window.mouse_selecting) {
|
||||||
Vec2 mouse_lookup = mouse - window.rect.min + window.scroll;
|
Vec2 mouse_lookup = mouse - window.rect.min + window.scroll;
|
||||||
|
Vec2 mouse_in_text = mouse - window.rect.min;
|
||||||
LayoutRow *row = GetLayoutRow(window, mouse_lookup.y);
|
LayoutRow *row = GetLayoutRow(window, mouse_lookup.y);
|
||||||
if (row == NULL) {
|
if (row == NULL) {
|
||||||
if (mouse.y < 0) {
|
if (mouse_in_text.y < 0) {
|
||||||
row = window.layout.rows.first();
|
row = window.layout.rows.first();
|
||||||
} else {
|
} else {
|
||||||
row = window.layout.rows.last();
|
row = window.layout.rows.last();
|
||||||
@@ -516,7 +516,7 @@ int main() {
|
|||||||
|
|
||||||
LayoutColumn *col = GetLayoutColumn(row, mouse_lookup.x);
|
LayoutColumn *col = GetLayoutColumn(row, mouse_lookup.x);
|
||||||
if (col == NULL) {
|
if (col == NULL) {
|
||||||
if (mouse.x < 0) {
|
if (mouse_in_text.x < 0) {
|
||||||
col = row->columns.first();
|
col = row->columns.first();
|
||||||
} else {
|
} else {
|
||||||
col = row->columns.last();
|
col = row->columns.last();
|
||||||
|
|||||||
Reference in New Issue
Block a user