修改旋转判定,添加style渲染接口
parent
f2ceca724a
commit
97097fcc3a
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue