#pragma once
#include "node_border.h"

class NodeScroll : public NodeBorder
{
    bool m_dragging = false;
    float m_drag_dir = 1.f;
    glm::vec2 m_drag_start = glm::vec2(0);
    glm::vec2 m_offset_start = glm::vec2(0);
    glm::vec2 m_offset = glm::vec2(0);
    glm::vec2 m_mask = glm::vec2(0, 1);
    glm::vec4 m_scrollbar_color = { .3, .3, .3, 1 };
public:
    enum class kScrollDirection : uint8_t { Vertical, Horizontal } m_direction;
    virtual Node* clone_instantiate() const override;
    virtual void clone_copy(Node* dest) const override;
    virtual kEventResult handle_event(Event* e) override;
    virtual void draw() override;
    virtual void on_tick(float dt) override;
    virtual void parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr) override;
    void fix_scroll();
};
