Popup presets panel, fix padding scissor, stacked mouse capture
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "shader.h"
|
||||
#include "bezier.h"
|
||||
#include "canvas.h"
|
||||
#include "app.h"
|
||||
|
||||
Node* NodeStrokePreview::clone_instantiate() const
|
||||
{
|
||||
@@ -68,7 +69,7 @@ void NodeStrokePreview::draw_stroke()
|
||||
glm::mat4 proj = glm::ortho<float>(0, (float)m_rtt.getWidth(), 0, (float)m_rtt.getHeight(), -1, 1);
|
||||
|
||||
const auto& b = m_brush;
|
||||
m_stroke.m_max_size = 0.1f;
|
||||
m_stroke.m_max_size = m_size.y / 800.f * App::I.zoom;
|
||||
m_stroke.m_camera.fov = Canvas::I->m_cam_fov;
|
||||
m_stroke.m_camera.rot = Canvas::I->m_cam_rot;
|
||||
m_stroke.reset();
|
||||
@@ -141,10 +142,10 @@ void NodeStrokePreview::draw()
|
||||
|
||||
void NodeStrokePreview::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
|
||||
{
|
||||
if (old_size == new_size)
|
||||
if (m_rtt.getWidth() == new_size.x && m_rtt.getHeight() == new_size.y || !m_brush)
|
||||
return;
|
||||
|
||||
float pad = 30.f;
|
||||
float pad = m_size.x * .15f;
|
||||
new_size *= root()->m_zoom;
|
||||
float w = new_size.x;
|
||||
float h = new_size.y;
|
||||
@@ -152,7 +153,11 @@ void NodeStrokePreview::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
|
||||
m_stroke.reset();
|
||||
m_stroke.start(m_brush);
|
||||
for (int i = 0; i < 20; i++)
|
||||
m_stroke.add_point(glm::vec3(BezierCurve::Bezier2D(kp, i / 20.f), 0), 1.f);
|
||||
{
|
||||
float t = (float)i / 20.f;
|
||||
float p = 1.f - glm::abs(t * 2.f - 1.f);
|
||||
m_stroke.add_point(glm::vec3(BezierCurve::Bezier2D(kp, t), 0), p);
|
||||
}
|
||||
|
||||
m_rtt.destroy();
|
||||
m_rtt.create((int)new_size.x, (int)new_size.y);
|
||||
|
||||
Reference in New Issue
Block a user