diff --git a/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp b/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp index d3dc67b..9602f2d 100644 --- a/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp +++ b/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp @@ -87,11 +87,20 @@ QJsonObject GraphicElement::toJson() const void SimpleElement::paint(QPainter* painter, QTransform transform, vector> styles) { - Renderer::ElementStyleStrokeDemo demo(2); - auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0); painter->save(); painter->setTransform(transform); - painter->drawImage(mov, img); + 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->restore(); } diff --git a/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp b/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp index d8199c7..485977d 100644 --- a/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp +++ b/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp @@ -88,9 +88,9 @@ void PreviewWindow::mouseMoveEvent(QMouseEvent* event) currentLayer->property.offset.setY(currentLayer->property.offset.y() + dy); qDebug() << dx << "----" << dy; } - 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; } }