Browse Source

Add menu separator to switch param tooltip. Fix bug when ParamWidget tooltip is not appearing when Light is placed above it.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
b2e00b2b06
2 changed files with 11 additions and 3 deletions
  1. +5
    -2
      src/app/ModuleLightWidget.cpp
  2. +6
    -1
      src/app/ParamWidget.cpp

+ 5
- 2
src/app/ModuleLightWidget.cpp View File

@@ -70,8 +70,6 @@ void ModuleLightWidget::createTooltip() {
return;
if (this->tooltip)
return;
if (!module)
return;
// If the LightInfo is null, don't show a tooltip
if (!getLightInfo())
return;
@@ -123,6 +121,11 @@ void ModuleLightWidget::step() {
void ModuleLightWidget::onHover(const HoverEvent& e) {
// Adapted from OpaqueWidget::onHover()
Widget::onHover(e);

// If the LightInfo is null, don't consume Hover event
if (!getLightInfo())
return;

e.stopPropagating();
// Consume if not consumed by child
if (!e.isConsumed())


+ 6
- 1
src/app/ParamWidget.cpp View File

@@ -1,5 +1,6 @@
#include <app/ParamWidget.hpp>
#include <ui/MenuOverlay.hpp>
#include <ui/MenuSeparator.hpp>
#include <ui/TextField.hpp>
#include <app/Scene.hpp>
#include <context.hpp>
@@ -249,7 +250,8 @@ void ParamWidget::createContextMenu() {

if (switchQuantity) {
int index = (int) std::floor(pq->getValue());
for (int i = 0; i < (int) switchQuantity->labels.size(); i++) {
int numStates = switchQuantity->labels.size();
for (int i = 0; i < numStates; i++) {
std::string label = switchQuantity->labels[i];
ParamValueItem* paramValueItem = new ParamValueItem;
paramValueItem->text = label;
@@ -258,6 +260,9 @@ void ParamWidget::createContextMenu() {
paramValueItem->value = i;
menu->addChild(paramValueItem);
}
if (numStates > 0) {
menu->addChild(new ui::MenuSeparator);
}
}
else {
ParamField* paramField = new ParamField;


Loading…
Cancel
Save