mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
make scrollbar interactive
This commit is contained in:
parent
bad2b44c96
commit
b65ba61f9a
6 changed files with 65 additions and 16 deletions
|
|
@ -74,6 +74,9 @@ void TextBox::draw(const DrawContext* pctx, Assets* assets) {
|
|||
batch->rect(lcoord.x + width, lcoord.y+label->getLineYOffset(line), 2, lineHeight);
|
||||
}
|
||||
if (selectionStart != selectionEnd) {
|
||||
auto selectionCtx = subctx.sub(batch);
|
||||
selectionCtx.setBlendMode(BlendMode::addition);
|
||||
|
||||
uint startLine = label->getLineByTextIndex(selectionStart);
|
||||
uint endLine = label->getLineByTextIndex(selectionEnd);
|
||||
|
||||
|
|
@ -433,7 +436,11 @@ void TextBox::click(GUI*, int x, int y) {
|
|||
selectionOrigin = index;
|
||||
}
|
||||
|
||||
void TextBox::mouseMove(GUI*, int x, int y) {
|
||||
void TextBox::mouseMove(GUI* gui, int x, int y) {
|
||||
Container::mouseMove(gui, x, y);
|
||||
if (isScrolling()) {
|
||||
return;
|
||||
}
|
||||
ptrdiff_t index = calcIndexAt(x, y);
|
||||
setCaret(index);
|
||||
extendSelection(index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue