修改旋转判定,添加style渲染接口

dev-LayerStyle
karlis 2023-03-14 15:36:19 +08:00
parent f2ceca724a
commit 97097fcc3a
2 changed files with 14 additions and 5 deletions

View File

@ -87,11 +87,20 @@ QJsonObject GraphicElement::toJson() const
void SimpleElement::paint(QPainter* painter, QTransform transform, vector<std::shared_ptr<LayerStyle>> styles) void SimpleElement::paint(QPainter* painter, QTransform transform, vector<std::shared_ptr<LayerStyle>> styles)
{ {
Renderer::ElementStyleStrokeDemo demo(2);
auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0);
painter->save(); painter->save();
painter->setTransform(transform); painter->setTransform(transform);
if (styles.empty())
{
painter->drawPath(painterPath);
}
else
{
// TODO:Ó¦ÓÃstyle
Renderer::ElementStyleStrokeDemo demo(2);
auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0);
painter->drawImage(mov, img); painter->drawImage(mov, img);
}
painter->restore(); painter->restore();
} }

View File

@ -90,7 +90,7 @@ void PreviewWindow::mouseMoveEvent(QMouseEvent* event)
} }
else if (event->buttons() & Qt::RightButton) { else if (event->buttons() & Qt::RightButton) {
// 如果按下的是右键,那么旋转图形 // 如果按下的是右键,那么旋转图形
qreal angle = -sqrt(dx * dx + dy * dy) / 1.0; qreal angle = dx;
currentLayer->property.rotation += angle; currentLayer->property.rotation += angle;
} }
} }