From 35e7648206245804e7b2c3c51e94aa6caaac8af5 Mon Sep 17 00:00:00 2001 From: wuyize Date: Tue, 21 Mar 2023 12:24:42 +0800 Subject: [PATCH] =?UTF-8?q?FIX:=20setWindow=E5=8F=82=E6=95=B0=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Editor/PreviewWindow.cpp | 2 +- .../src/Editor/util/PaintingUtil.cpp | 2 +- test.json | 74 +++++++++++-------- 3 files changed, 45 insertions(+), 33 deletions(-) diff --git a/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp b/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp index 7745de2..61ba7d3 100644 --- a/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp +++ b/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp @@ -51,7 +51,7 @@ void PreviewWindow::paintGL() glClearColor(backgroundColor.redF(), backgroundColor.greenF(), backgroundColor.blueF(), backgroundColor.alphaF()); glClear(GL_COLOR_BUFFER_BIT); painter->begin(this); - painter->setWindow(0, 0, logicalSize.width(), logicalSize.height()); + painter->setWindow(0, 0, logicalSize.width() *devicePixelRatioF(), logicalSize.height() * devicePixelRatioF()); painter->setRenderHint(QPainter::Antialiasing); painter->setRenderHint(QPainter::HighQualityAntialiasing); layerManager->paint(painter,this->size(),currentLayer); diff --git a/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp b/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp index 1d5dd71..5c7e3f4 100644 --- a/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp +++ b/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp @@ -84,7 +84,7 @@ FolderLayerWrapper* PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTr //qDebug() << leafLayer<<"------" << painterPath; // transform to -1£¬ 1 QTransform trans; - double maxLen = std::max(bound.width(), bound.height()); + double maxLen = std::max(bound.width(), bound.height()) * 1.00001; qDebug() << maxLen << bound; trans.scale(1 / maxLen, 1 / maxLen); trans.translate(-bound.center().x(), -bound.center().y()); diff --git a/test.json b/test.json index 777aeec..1d80489 100644 --- a/test.json +++ b/test.json @@ -29,30 +29,6 @@ "children": [ { "children": [ - { - "element": 0, - "is-folder": false, - "name": "Leaf1", - "styles": [ - { - "enableEachSideIndependent": false, - "left": "AACgQAEAIZwAf///AZ5X/w==", - "right": "AADgQAAACJw=", - "type": "stroke" - } - ], - "transform": { - "offset": { - "x": 0, - "y": 0 - }, - "rotation": 0, - "scale": { - "x": 1, - "y": 1 - } - } - }, { "element": 0, "is-folder": false, @@ -61,14 +37,14 @@ { "enableEachSideIndependent": false, "left": "AABAQAEAIZwAf///AFqe/w==", - "right": "AADgQAAACJw=", + "right": "AABAQAEACJwAf////1UA/w==", "type": "stroke" } ], "transform": { "offset": { - "x": 150, - "y": 0 + "x": 501, + "y": -3 }, "rotation": 0, "scale": { @@ -96,15 +72,51 @@ { "element": 1, "is-folder": false, - "name": "ReferencingGroupLayer", + "name": "å­å›¾å±‚-2", "styles": [ ], "transform": { "offset": { - "x": 100, - "y": 0 + "x": -2, + "y": 515 }, - "rotation": 45, + "rotation": 0, + "scale": { + "x": 1, + "y": 1 + } + } + }, + { + "element": 1, + "is-folder": false, + "name": "å­å›¾å±‚-3", + "styles": [ + ], + "transform": { + "offset": { + "x": -503, + "y": -1 + }, + "rotation": 0, + "scale": { + "x": 1, + "y": 1 + } + } + }, + { + "element": 1, + "is-folder": false, + "name": "å­å›¾å±‚-4", + "styles": [ + ], + "transform": { + "offset": { + "x": -503, + "y": 511 + }, + "rotation": 0, "scale": { "x": 1, "y": 1