improve layout
This commit is contained in:
@@ -303,6 +303,8 @@ void App::init_sidebar()
|
||||
layers->m_capture_children = false;
|
||||
layers->m_mouse_ignore = false;
|
||||
layers->mouse_capture();
|
||||
auto scroll = layers->find<NodeScroll>("layers-container");
|
||||
scroll->SetMaxHeight(glm::max(100.f, screen.y - pos.y - 200.f));
|
||||
layout[main_id]->update();
|
||||
|
||||
layers->on_popup_close = [this, tick](Node*) {
|
||||
@@ -328,6 +330,8 @@ void App::init_sidebar()
|
||||
grid->m_capture_children = false;
|
||||
grid->m_mouse_ignore = false;
|
||||
grid->mouse_capture();
|
||||
auto scroll = grid->find<NodeScroll>("scroller");
|
||||
scroll->SetMaxHeight(glm::max(100.f, screen.y - pos.y - 250.f));
|
||||
layout[main_id]->update();
|
||||
|
||||
grid->on_popup_close = [this, tick](Node*) {
|
||||
|
||||
@@ -33,7 +33,7 @@ void NodePanelGrid::init_controls()
|
||||
m_hm_preview = find<NodeImageTexture>("grid-heightmap-preview");
|
||||
m_hm_load = find<NodeButton>("grid-heightmap-load");
|
||||
m_hm_clear = find<NodeButton>("grid-heightmap-clear");
|
||||
m_hm_reload = find<NodeButtonCustom>("grid-heightmap-reload");
|
||||
m_hm_reload = find<NodeButton>("grid-heightmap-reload");
|
||||
m_hm_wireframe = find<NodeSliderH>("grid-heightmap-wireframe");
|
||||
m_hm_thickness = find<NodeSliderH>("grid-heightmap-thickness");
|
||||
m_hm_height = find<NodeSliderH>("grid-heightmap-height");
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
NodeImageTexture* m_hm_preview;
|
||||
NodeButton* m_hm_load;
|
||||
NodeButton* m_hm_clear;
|
||||
NodeButtonCustom* m_hm_reload;
|
||||
NodeButton* m_hm_reload;
|
||||
NodeComboBox* m_hm_shading;
|
||||
NodeSliderH* m_hm_height;
|
||||
NodeSliderH* m_hm_wireframe;
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
Sampler m_sampler_linear;
|
||||
std::string m_file_path;
|
||||
nanort::BVHAccel<float> m_rt_accel;
|
||||
bool m_rt_dirty = true;;
|
||||
bool m_rt_dirty = true;
|
||||
ShadeMode m_shade_mode{ ShadeMode::Transparent };
|
||||
GLfloat m_line_range[2];
|
||||
GLfloat m_line_granularity;
|
||||
|
||||
@@ -111,7 +111,7 @@ Node* NodePanelLayer::clone_instantiate() const
|
||||
void NodePanelLayer::init()
|
||||
{
|
||||
init_template("tpl-panel-layers");
|
||||
m_layers_container = find<NodeBorder>("layers-container");
|
||||
m_layers_container = find<NodeScroll>("layers-container");
|
||||
btn_add = find<NodeButtonCustom>("btn-add");
|
||||
btn_remove = find<NodeButtonCustom>("btn-remove");
|
||||
btn_up = find<NodeButtonCustom>("btn-up");
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "node_slider.h"
|
||||
#include "node_button_custom.h"
|
||||
#include "node_combobox.h"
|
||||
#include "node_scroll.h"
|
||||
|
||||
class NodeLayer : public NodeBorder
|
||||
{
|
||||
@@ -52,7 +53,7 @@ public:
|
||||
std::function<void(Node* target, int old_idx, int new_idx)> on_layer_order;
|
||||
NodeLayer* m_current_layer = nullptr;
|
||||
std::vector<NodeLayer*> m_layers;
|
||||
NodeBorder* m_layers_container;
|
||||
NodeScroll* m_layers_container;
|
||||
NodeSliderH* m_opacity;
|
||||
NodeCheckBox* m_alpha_lock;
|
||||
NodeComboBox* m_blend_mode;
|
||||
|
||||
@@ -59,7 +59,7 @@ void NodeScroll::on_tick(float dt)
|
||||
auto rect = get_children_rect();
|
||||
// fix scrollbar
|
||||
float sz = m_size.y - (pad[0] + pad[2]);
|
||||
float new_pad = rect.w == 0 || rect.w <= sz ? 5 : 35;
|
||||
float new_pad = rect.w == 0 || rect.w <= sz + 2 ? 5 : 35;
|
||||
if (pad[1] != new_pad)
|
||||
{
|
||||
YGNodeStyleSetPadding(y_node, YGEdgeRight, new_pad);
|
||||
|
||||
Reference in New Issue
Block a user