2022-11-17 17:33:48 +00:00
|
|
|
#include "ImageViewWidget.h"
|
|
|
|
|
|
|
|
#include "GridNode.h"
|
|
|
|
#include "TransformNode.h"
|
|
|
|
|
2023-01-17 13:01:59 +00:00
|
|
|
#include "ThemeManager.h"
|
|
|
|
#include "PaintEvent.h"
|
2022-11-17 17:33:48 +00:00
|
|
|
|
|
|
|
ImageViewWidget::ImageViewWidget()
|
|
|
|
{
|
|
|
|
mName = "ImageViewWidget";
|
|
|
|
}
|
|
|
|
|
2023-01-23 10:08:29 +00:00
|
|
|
ImageViewWidget::~ImageViewWidget()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-11-17 17:33:48 +00:00
|
|
|
void ImageViewWidget::doPaint(const PaintEvent* event)
|
|
|
|
{
|
|
|
|
if (!mVisible)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mGridNode)
|
|
|
|
{
|
2023-01-20 08:07:09 +00:00
|
|
|
mGridNode = std::make_unique<GridNode>(Transform(mLocation));
|
2022-11-17 17:33:48 +00:00
|
|
|
mGridNode->setName(mName + "_GridNode");
|
|
|
|
mGridNode->setNumX(mNumX);
|
|
|
|
mGridNode->setNumY(mNumY);
|
|
|
|
|
|
|
|
mGridNode->setWidth(mSize.mWidth);
|
|
|
|
mGridNode->setHeight(mSize.mHeight);
|
2022-11-18 09:43:22 +00:00
|
|
|
|
2023-01-17 13:01:59 +00:00
|
|
|
mGridNode->setStrokeColor(event->getThemesManager()->getColor(mBorder));
|
2022-11-18 09:43:22 +00:00
|
|
|
|
2022-11-17 17:33:48 +00:00
|
|
|
mRootNode->addChild(mGridNode.get());
|
|
|
|
}
|
2022-11-18 09:43:22 +00:00
|
|
|
|
|
|
|
if (mTransformDirty)
|
|
|
|
{
|
|
|
|
mGridNode->setWidth(mSize.mWidth);
|
|
|
|
mGridNode->setHeight(mSize.mHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mMaterialDirty)
|
|
|
|
{
|
2023-01-17 13:01:59 +00:00
|
|
|
mGridNode->setFillColor(event->getThemesManager()->getColor(mBorder));
|
2022-11-18 09:43:22 +00:00
|
|
|
}
|
2022-11-17 17:33:48 +00:00
|
|
|
}
|