Route canvas camera reset through app core
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "app_core/canvas_hotkey.h"
|
||||
#include "app_core/canvas_tool_ui.h"
|
||||
#include "app_core/canvas_view.h"
|
||||
#include "app_core/document_animation.h"
|
||||
#include "app.h"
|
||||
#include "legacy_canvas_tool_services.h"
|
||||
@@ -978,10 +979,22 @@ kEventResult NodeCanvas::handle_event(Event* e)
|
||||
|
||||
void NodeCanvas::reset_camera()
|
||||
{
|
||||
m_canvas->m_cam_rot = glm::mat4(1);
|
||||
m_canvas->m_cam_pos = {0, 0, 0};
|
||||
m_canvas->m_cam_fov = 85;
|
||||
m_canvas->m_pan = {0, 0};
|
||||
const auto state = pp::app::plan_canvas_camera_reset();
|
||||
m_canvas->m_cam_rot = glm::mat4(
|
||||
state.rotation[0], state.rotation[1], state.rotation[2], state.rotation[3],
|
||||
state.rotation[4], state.rotation[5], state.rotation[6], state.rotation[7],
|
||||
state.rotation[8], state.rotation[9], state.rotation[10], state.rotation[11],
|
||||
state.rotation[12], state.rotation[13], state.rotation[14], state.rotation[15]);
|
||||
m_canvas->m_cam_pos = {
|
||||
state.position[0],
|
||||
state.position[1],
|
||||
state.position[2],
|
||||
};
|
||||
m_canvas->m_cam_fov = state.field_of_view_degrees;
|
||||
m_canvas->m_pan = {
|
||||
state.pan[0],
|
||||
state.pan[1],
|
||||
};
|
||||
}
|
||||
|
||||
void NodeCanvas::create_buffers()
|
||||
|
||||
Reference in New Issue
Block a user