Clean up of scene nodes to support 2d and non int positioning.
This commit is contained in:
parent
1eeaebd0a9
commit
672b31b603
45 changed files with 341 additions and 200 deletions
51
src/visual_elements/nodes/TextNode.h
Normal file
51
src/visual_elements/nodes/TextNode.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
#pragma once
|
||||
|
||||
#include "MaterialNode.h"
|
||||
|
||||
#include "FontItem.h"
|
||||
#include "TextData.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class FontsManager;
|
||||
|
||||
class TextNode : public MaterialNode
|
||||
{
|
||||
public:
|
||||
TextNode(const std::string& content, const Point& loc);
|
||||
|
||||
~TextNode();
|
||||
|
||||
static std::unique_ptr<TextNode> Create(const std::string& content, const Point& loc);
|
||||
|
||||
std::string getContent() const;
|
||||
std::string getFontLabel() const;
|
||||
|
||||
SceneItem* getSceneItem(std::size_t idx) const override;
|
||||
std::size_t getNumSceneItems() const override;
|
||||
|
||||
double getWidth() const;
|
||||
double getHeight() const;
|
||||
|
||||
void setWidth(double width);
|
||||
void setHeight(double height);
|
||||
|
||||
void setContent(const std::string& content);
|
||||
|
||||
void update(SceneInfo* sceneInfo) override;
|
||||
private:
|
||||
|
||||
void updateLines(FontsManager* fontsManager);
|
||||
|
||||
TextData mTextData;
|
||||
bool mContentIsDirty{true};
|
||||
bool mLinesAreDirty{true};
|
||||
|
||||
double mWidth{1};
|
||||
double mHeight{1};
|
||||
|
||||
std::unique_ptr<SceneItem> mTextItem;
|
||||
};
|
||||
|
||||
using TextNodetr = std::unique_ptr<TextNode>;
|
Loading…
Add table
Add a link
Reference in a new issue