#pragma once

#include "AbstractVisualNode.h"
#include "FontItem.h"

class TextNode;
class LineNode;
class LatexMathExpression;

class EquationNode : public AbstractVisualNode
{
public:
	EquationNode(const Transform& t = {});

	virtual ~EquationNode();

	void setContent(LatexMathExpression* content);

	void update(SceneInfo* sceneInfo) override;

protected:
	void createOrUpdateGeometry(SceneInfo* sceneInfo);

	void addExpression(SceneInfo* sceneInfo, const LatexMathExpression* expression);


	std::vector<std::unique_ptr<TextNode> > mText;
	std::vector<std::unique_ptr<LineNode> > mLines;

	FontItem mDefaultFont{ "Cambria Math", 14 };
	//FontItem mDefaultFont{ "Latin Modern Math", 14 };

	Point mTextCursor;

	LatexMathExpression* mContent{ nullptr };
	bool mContentDirty{ true };
};