Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple small improvements #160

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/nanogui/textarea.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ class NANOGUI_EXPORT TextArea : public Widget {
int padding() const { return m_padding; }

/// Set whether the text can be selected using the mouse
void set_selectable(int selectable) { m_selectable = selectable; }
void set_selectable(bool selectable) { m_selectable = selectable; }

/// Return whether the text can be selected using the mouse
int is_selectable() const { return m_selectable; }
bool is_selectable() const { return m_selectable; }

/// Append text at the end of the widget
void append(const std::string &text);
Expand Down
1 change: 0 additions & 1 deletion src/tabwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ void TabWidgetBase::perform_layout(NVGcontext* ctx) {
nvgFontSize(ctx, font_size());
nvgTextAlign(ctx, NVG_ALIGN_LEFT | NVG_ALIGN_TOP);

m_tab_offsets.clear();
int width = 0;
float unused[4];
for (const std::string &label : m_tab_captions) {
Expand Down
4 changes: 2 additions & 2 deletions src/textarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void TextArea::draw(NVGcontext *ctx) {
std::swap(selection_start, selection_end);
flip = true;
}
if (m_selection_end != Vector2i(-1) && m_selection_end != Vector2i(-1)) {
if (m_selection_start != Vector2i(-1) && m_selection_end != Vector2i(-1)) {
nvgBeginPath(ctx);
nvgFillColor(ctx, m_selection_color);
if (selection_end.y() == selection_start.y()) {
Expand Down Expand Up @@ -186,7 +186,7 @@ void TextArea::draw(NVGcontext *ctx) {

Vector2i offset = block.offset + m_pos + m_padding;

if (m_selection_end != Vector2i(-1) && m_selection_end != Vector2i(-1) &&
if (m_selection_start != Vector2i(-1) && m_selection_end != Vector2i(-1) &&
offset.y() > selection_start.y() && offset.y() < selection_end.y()) {
nvgFillColor(ctx, m_selection_color);
nvgBeginPath(ctx);
Expand Down