Merge branch 'main' into dev
This commit is contained in:
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
/// @brief Build atlas from all added images
|
||||
/// @param extrusion textures extrusion pixels
|
||||
/// (greather is less mip-mapping artifacts)
|
||||
/// (greater is less mip-mapping artifacts)
|
||||
/// @param prepare generate atlas texture (calls .prepare())
|
||||
/// @param maxResolution max atlas resolution
|
||||
std::unique_ptr<Atlas> build(uint extrusion, bool prepare=true, uint maxResolution=0);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
/// @brief Not greather than 64 for this BIG_PRIME value
|
||||
/// @brief Not greater than 64 for this BIG_PRIME value
|
||||
inline constexpr int UPDATE_AREA_DIAMETER = 32;
|
||||
/// @brief Number of blocks in the volume
|
||||
inline constexpr int UPDATE_BLOCKS =
|
||||
|
||||
@@ -253,9 +253,10 @@ void TextBox::draw(const DrawContext& pctx, const Assets& assets) {
|
||||
float time = gui.getWindow().time();
|
||||
|
||||
if (editable && static_cast<int>((time - caretLastMove) * 2) % 2 == 0) {
|
||||
uint line = rawTextCache.getLineByTextIndex(caret);
|
||||
uint lcaret = caret - rawTextCache.getTextLineOffset(line);
|
||||
uint line = label->getLineByTextIndex(caret);
|
||||
uint lcaret = caret - label->getTextLineOffset(line);
|
||||
int width = rawTextCache.metrics.calcWidth(input, 0, lcaret);
|
||||
|
||||
batch->rect(
|
||||
lcoord.x + width,
|
||||
lcoord.y + label->getLineYOffset(line),
|
||||
@@ -272,10 +273,10 @@ void TextBox::draw(const DrawContext& pctx, const Assets& assets) {
|
||||
|
||||
batch->setColor(glm::vec4(0.8f, 0.9f, 1.0f, 0.25f));
|
||||
int start = rawTextCache.metrics.calcWidth(
|
||||
labelText, selectionStart - label->getTextLineOffset(startLine)
|
||||
labelText, 0, selectionStart - label->getTextLineOffset(startLine)
|
||||
);
|
||||
int end = rawTextCache.metrics.calcWidth(
|
||||
labelText, selectionEnd - label->getTextLineOffset(endLine)
|
||||
labelText, 0, selectionEnd - label->getTextLineOffset(endLine)
|
||||
);
|
||||
int lineY = label->getLineYOffset(startLine);
|
||||
|
||||
@@ -1210,8 +1211,8 @@ void TextBox::setCaret(size_t position) {
|
||||
scrolled(-glm::ceil(offset / static_cast<double>(scrollStep) + 0.5f));
|
||||
}
|
||||
int lcaret = caret - rawTextCache.getTextLineOffset(line);
|
||||
int realoffset =
|
||||
rawTextCache.metrics.calcWidth(labelText, 0, lcaret) - static_cast<int>(textOffset) + 2;
|
||||
int realoffset = rawTextCache.metrics.calcWidth(labelText, 0, lcaret) -
|
||||
static_cast<int>(textOffset) + 2;
|
||||
|
||||
if (realoffset - width > 0) {
|
||||
setTextOffset(textOffset + realoffset - width);
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace gui {
|
||||
runnable onDownPressed;
|
||||
/// @brief Is current input valid
|
||||
bool valid = true;
|
||||
/// @brief Text input pointer, value may be greather than text length
|
||||
/// @brief Text input pointer, value may be greater than text length
|
||||
size_t caret = 0;
|
||||
/// @brief Actual local (line) position of the caret on vertical move
|
||||
size_t maxLocalCaret = 0;
|
||||
|
||||
Reference in New Issue
Block a user