Skip to content

Commit

Permalink
Path Op: reverse box order
Browse files Browse the repository at this point in the history
Ref: #294
  • Loading branch information
rodlie committed Nov 27, 2024
1 parent d3f71a5 commit bcd9a4f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/core/canvasselectedboxesactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,17 +700,20 @@ void Canvas::createLinkBoxForSelected() {
mCurrentContainer->addContained(selectedBox->createLink(false));
}

SmartVectorPath *Canvas::getPathResultingFromOperation(const SkPathOp& pathOp) {
SmartVectorPath *Canvas::getPathResultingFromOperation(const SkPathOp& pathOp)
{
const auto newPath = enve::make_shared<SmartVectorPath>();
newPath->planCenterPivotPosition();
SkOpBuilder builder;
bool first = true;
for(const auto &box : mSelectedBoxes) {
if(const auto pBox = enve_cast<PathBox*>(box)) {
const QList<BoundingBox*> boxes(mSelectedBoxes.rbegin(),
mSelectedBoxes.rend());
for (const auto &box : boxes) {
if (const auto pBox = enve_cast<PathBox*>(box)) {
SkPath boxPath = pBox->getRelativePath();
const QMatrix boxTrans = box->getRelativeTransformAtCurrentFrame();
boxPath.transform(toSkMatrix(boxTrans));
if(first) {
if (first) {
builder.add(boxPath, SkPathOp::kUnion_SkPathOp);
first = false;
pBox->copyDataToOperationResult(newPath.get());
Expand All @@ -721,7 +724,7 @@ SmartVectorPath *Canvas::getPathResultingFromOperation(const SkPathOp& pathOp) {
}
SkPath resultPath;
builder.resolve(&resultPath);
if(resultPath.isEmpty()) {
if (resultPath.isEmpty()) {
return getPathResultingFromCombine();
} else {
newPath->loadSkPath(resultPath);
Expand Down

0 comments on commit bcd9a4f

Please sign in to comment.