#include "pch.h"

#include <algorithm>
#include <array>
#include <cstdint>
#include <memory>
#include <vector>

#include "app_core/document_animation.h"
#include "app.h"
#include "legacy_node_canvas_draw_services.h"
#include "legacy_node_canvas_state_services.h"
#include "legacy_canvas_tool_services.h"
#include "node_canvas.h"

Node* NodeCanvas::clone_instantiate() const
{
    return new NodeCanvas();
}

void NodeCanvas::init()
{
    pp::panopainter::init_legacy_node_canvas_shell(*this);
}

void NodeCanvas::restore_context()
{
    pp::panopainter::restore_legacy_node_canvas_context(*this);
}

void NodeCanvas::clear_context()
{
    pp::panopainter::clear_legacy_node_canvas_context(*this);
}

void NodeCanvas::draw()
{
    pp::panopainter::draw_legacy_node_canvas_shell(*this);
}

void NodeCanvas::handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom)
{
    pp::panopainter::handle_legacy_node_canvas_resize(*this, old_size, new_size, zoom);
}

kEventResult NodeCanvas::handle_event(Event* e)
{
    Node::handle_event(e);
    return pp::panopainter::handle_legacy_node_canvas_event(*this, e);
}

void NodeCanvas::reset_camera()
{
    pp::panopainter::reset_legacy_node_canvas_camera(*this);
}

void NodeCanvas::create_buffers()
{
    pp::panopainter::create_legacy_node_canvas_buffers(*this);
}

void NodeCanvas::set_density(float d)
{
    pp::panopainter::set_legacy_node_canvas_density(*this, d);
}

void NodeCanvas::set_cursor_visibility(kCursorVisibility mode)
{
    pp::panopainter::set_legacy_node_canvas_cursor_visibility(*this, mode);
}

void NodeCanvas::update_cursor()
{
    pp::panopainter::update_legacy_node_canvas_cursor(*this);
}

void NodeCanvas::on_tick(float dt)
{
    pp::panopainter::tick_legacy_node_canvas_state(*this, dt);
}

void NodeCanvas::destroy()
{
    pp::panopainter::destroy_legacy_node_canvas_state(*this);
}
